summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorced <>2007-08-10 07:50:08 +0000
committerced <>2007-08-10 07:50:08 +0000
commit968a2cb4ebf94e8cbde188970f174de15b66092c (patch)
treedb28776ee1e80cccd624c61e194d5dd6e9eee015
parent15a2d0287a4b1cdd1d819cf65a835395ddacec72 (diff)
Move less used modules to extra_addons repo
bzr revid: ced-67ee0e1f0bad58fd390763b2b5a6c7d233c48223
-rw-r--r--addons/account_asset/__init__.py31
-rw-r--r--addons/account_asset/__terp__.py23
-rw-r--r--addons/account_asset/account_asset.py331
-rw-r--r--addons/account_asset/account_asset_invoice.py54
-rw-r--r--addons/account_asset/account_asset_invoice_view.xml22
-rw-r--r--addons/account_asset/account_asset_view.xml278
-rw-r--r--addons/account_asset/account_asset_wizard.xml31
-rw-r--r--addons/account_asset/wizard/__init__.py31
-rw-r--r--addons/account_asset/wizard/wizard_asset_close.py56
-rw-r--r--addons/account_asset/wizard/wizard_asset_compute.py109
-rw-r--r--addons/account_asset/wizard/wizard_asset_modify.py93
-rw-r--r--addons/account_cash_discount/__init__.py29
-rw-r--r--addons/account_cash_discount/__terp__.py25
-rw-r--r--addons/account_cash_discount/account_cash_discount.py78
-rw-r--r--addons/account_cash_discount/account_cash_discount_view.xml47
-rw-r--r--addons/account_simulation/__init__.py30
-rw-r--r--addons/account_simulation/__terp__.py20
-rw-r--r--addons/account_simulation/account_simulation.py90
-rw-r--r--addons/account_simulation/account_simulation_demo.xml16
-rw-r--r--addons/account_simulation/account_simulation_view.xml78
-rw-r--r--addons/account_simulation/wizard/__init__.py29
-rw-r--r--addons/account_simulation/wizard/wizard_account_chart.py81
-rw-r--r--addons/airport/1000000000000144000000689888B27C.gifbin10510 -> 0 bytes
-rw-r--r--addons/airport/__init__.py29
-rw-r--r--addons/airport/__terp__.py12
-rw-r--r--addons/airport/custom.py24
-rw-r--r--addons/airport/custom_report.xml11
-rw-r--r--addons/airport/custom_view.xml66
-rw-r--r--addons/airport/ticket.rml86
-rw-r--r--addons/airport/ticket.sxwbin17163 -> 0 bytes
-rw-r--r--addons/analytic_partners/__init__.py3
-rw-r--r--addons/analytic_partners/__terp__.py25
-rw-r--r--addons/analytic_partners/analytic_partners.py10
-rw-r--r--addons/analytic_partners/analytic_partners_report.xml11
-rw-r--r--addons/analytic_partners/analytic_partners_view.xml18
-rw-r--r--addons/analytic_partners/report/__init__.py1
-rw-r--r--addons/analytic_partners/report/analytic_account_partners.rml140
-rw-r--r--addons/analytic_partners/report/analytic_partners_report.py33
-rw-r--r--addons/audittrail/__init__.py1
-rw-r--r--addons/audittrail/__terp__.py14
-rw-r--r--addons/audittrail/audittrail.py92
-rw-r--r--addons/audittrail/audittrail_demo.xml10
-rw-r--r--addons/audittrail/audittrail_view.xml92
-rw-r--r--addons/base_partner_relation/__init__.py31
-rw-r--r--addons/base_partner_relation/__terp__.py19
-rw-r--r--addons/base_partner_relation/partner_relation.py78
-rw-r--r--addons/base_partner_relation/partner_relation_view.xml52
-rw-r--r--addons/base_partner_sequence/__init__.py29
-rw-r--r--addons/base_partner_sequence/__terp__.py21
-rw-r--r--addons/base_partner_sequence/partner_sequence.py40
-rw-r--r--addons/base_partner_sequence/partner_sequence.xml21
-rw-r--r--addons/edi/__init__.py36
-rw-r--r--addons/edi/__terp__.py13
-rw-r--r--addons/edi/data/README10
-rw-r--r--addons/edi/data/edi/reception/encours/COMMANDE.2028940
-rw-r--r--addons/edi/data/edi/reception/encours/COMMANDE.2032710
-rw-r--r--addons/edi/data/edi/reception/encours/COMMANDE.TXT0
-rw-r--r--addons/edi/data/edi/reception/encours/COMMANDE.lec10
-rw-r--r--addons/edi/edi.py35
-rw-r--r--addons/edi/edi_data.xml20
-rw-r--r--addons/edi/edi_view.xml51
-rw-r--r--addons/edi/edi_wizard.xml10
-rw-r--r--addons/edi/partner.py47
-rw-r--r--addons/edi/report/import-results.xml1
-rw-r--r--addons/edi/report/import-results.xsl9
-rw-r--r--addons/edi/sale_cust_price.py45
-rw-r--r--addons/edi/sale_cust_price.xml29
-rw-r--r--addons/edi/wizard/__init__.py28
-rw-r--r--addons/edi/wizard/edi_exchange.py127
-rw-r--r--addons/edi/wizard/wizard_edi_export.py69
-rw-r--r--addons/edi/wizard/wizard_edi_import.py488
-rw-r--r--addons/esale_ez/__init__.py1
-rw-r--r--addons/esale_ez/__terp__.py14
-rw-r--r--addons/esale_ez/esale.py251
-rw-r--r--addons/esale_ez/esale_data.xml18
-rw-r--r--addons/esale_ez/esale_demo.xml10
-rw-r--r--addons/esale_ez/esale_view.xml167
-rw-r--r--addons/esale_joomla/__init__.py0
-rw-r--r--addons/esale_joomla/__terp__.py21
-rw-r--r--addons/esale_joomla/connector/tinyerp-synchro.php327
-rw-r--r--addons/esale_joomla/connector/xmlrpc.inc3600
-rw-r--r--addons/esale_joomla/connector/xmlrpcs.inc1040
-rw-r--r--addons/esale_joomla/esale_joomla.py293
-rw-r--r--addons/esale_joomla/esale_joomla_view.xml204
-rw-r--r--addons/esale_joomla/esale_joomla_wizard.xml43
-rw-r--r--addons/esale_joomla/esale_joomla_workflow.xml0
-rw-r--r--addons/esale_joomla/wizard/__init__.py3
-rw-r--r--addons/esale_joomla/wizard/wizard_esale_import.py105
-rw-r--r--addons/esale_joomla/wizard/wizard_product_export.py179
-rw-r--r--addons/esale_joomla/wizard/wizard_product_stock.py76
-rw-r--r--addons/esale_osc/__init__.py2
-rw-r--r--addons/esale_osc/__terp__.py21
-rw-r--r--addons/esale_osc/connector/oscommerce/tinyerp-syncro.php253
-rw-r--r--addons/esale_osc/connector/xmlrpc.inc3600
-rw-r--r--addons/esale_osc/connector/xmlrpcs.inc1040
-rw-r--r--addons/esale_osc/esale_osc.py217
-rw-r--r--addons/esale_osc/esale_osc_view.xml201
-rw-r--r--addons/esale_osc/esale_osc_wizard.xml12
-rw-r--r--addons/esale_osc/esale_osc_workflow.xml230
-rw-r--r--addons/esale_osc/wizard/__init__.py3
-rw-r--r--addons/esale_osc/wizard/wizard_esale_osc_export_products.py124
-rw-r--r--addons/esale_osc/wizard/wizard_esale_osc_import_sos.py115
-rw-r--r--addons/esale_osc/wizard/wizard_esale_osc_update_stocks.py50
-rw-r--r--addons/hr_contract_available/__init__.py31
-rw-r--r--addons/hr_contract_available/__terp__.py21
-rw-r--r--addons/hr_contract_available/hr_contract_available.py93
-rw-r--r--addons/hr_contract_available/hr_contract_available_view.xml67
-rw-r--r--addons/hr_evaluation/__init__.py33
-rw-r--r--addons/hr_evaluation/__terp__.py14
-rw-r--r--addons/hr_evaluation/hr_evaluation.py92
-rw-r--r--addons/hr_evaluation/hr_evaluation_demo.xml6
-rw-r--r--addons/hr_evaluation/hr_evaluation_view.xml207
-rw-r--r--addons/hr_skill/__init__.py29
-rw-r--r--addons/hr_skill/__terp__.py17
-rw-r--r--addons/hr_skill/hr_skill.evaluation.category.csv2
-rw-r--r--addons/hr_skill/hr_skill.evaluation.csv2
-rw-r--r--addons/hr_skill/hr_skill.experience.category.csv5
-rw-r--r--addons/hr_skill/hr_skill.experience.csv4
-rw-r--r--addons/hr_skill/hr_skill.position.csv3
-rw-r--r--addons/hr_skill/hr_skill.profile.csv5
-rw-r--r--addons/hr_skill/hr_skill.py268
-rw-r--r--addons/hr_skill/hr_skill.skill.csv12
-rw-r--r--addons/hr_skill/hr_skill.weight.category.csv3
-rw-r--r--addons/hr_skill/hr_skill.weight.csv8
-rw-r--r--addons/hr_skill/hr_skill_demo.xml19
-rw-r--r--addons/hr_skill/hr_skill_report.xml15
-rw-r--r--addons/hr_skill/hr_skill_view.xml354
-rw-r--r--addons/hr_skill/old-hr_skill.skill.csv12
-rw-r--r--addons/hr_skill/old-hr_skill_view.xml148
-rw-r--r--addons/hr_skill/report/evaluation.rml192
-rw-r--r--addons/hr_timesheet_ical/__init__.py28
-rw-r--r--addons/hr_timesheet_ical/__terp__.py14
-rw-r--r--addons/hr_timesheet_ical/hr_timesheet_wizard.xml7
-rw-r--r--addons/hr_timesheet_ical/wizard/__init__.py31
-rw-r--r--addons/hr_timesheet_ical/wizard/urllib2.py0
-rw-r--r--addons/hr_timesheet_ical/wizard/wizard_ical.py130
-rw-r--r--addons/letter/__init__.py31
-rw-r--r--addons/letter/__terp__.py13
-rw-r--r--addons/letter/letter.py97
-rw-r--r--addons/letter/letter_data.xml22
-rw-r--r--addons/letter/letter_report.xml9
-rw-r--r--addons/letter/letter_view.xml173
-rw-r--r--addons/letter/report/__init__.py1
-rw-r--r--addons/letter/report/custom_default.xsl36
-rw-r--r--addons/letter/report/custom_rml.xsl62
-rw-r--r--addons/letter/report/letter.py33
-rw-r--r--addons/letter/report/letter.rml551
-rw-r--r--addons/letter/report/letter.xml8
-rw-r--r--addons/letter/report/letter.xsl30
-rw-r--r--addons/letter/wizard/__init__.py28
-rw-r--r--addons/letter/wizard/wizard_paragraph_load.py71
-rw-r--r--addons/marketing/__init__.py42
-rw-r--r--addons/marketing/__terp__.py14
-rw-r--r--addons/marketing/campaign/__init__.py32
-rw-r--r--addons/marketing/campaign/campaign.py166
-rw-r--r--addons/marketing/campaign/campaign_demo.xml33
-rw-r--r--addons/marketing/campaign/campaign_view.xml189
-rw-r--r--addons/marketing/campaign/campaign_wizard.xml10
-rw-r--r--addons/marketing/campaign/wizard/__init__.py30
-rw-r--r--addons/marketing/campaign/wizard/wizard_campaign_email.py71
-rw-r--r--addons/marketing/campaign/wizard/wizard_campaign_partner_add.py79
-rw-r--r--addons/multi_company_hr_timesheet_sheet/__init__.py1
-rw-r--r--addons/multi_company_hr_timesheet_sheet/__terp__.py12
-rw-r--r--addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet.py40
-rw-r--r--addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_data.xml18
-rw-r--r--addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_view.xml17
-rw-r--r--addons/multi_company_project/__init__.py1
-rw-r--r--addons/multi_company_project/__terp__.py12
-rw-r--r--addons/multi_company_project/multi_company_project.py50
-rw-r--r--addons/multi_company_project/multi_company_project_data.xml30
-rw-r--r--addons/multi_company_project/multi_company_project_view.xml29
-rw-r--r--addons/network/__init__.py1
-rw-r--r--addons/network/__terp__.py19
-rw-r--r--addons/network/network.py164
-rw-r--r--addons/network/network_demo.xml108
-rw-r--r--addons/network/network_report.xml8
-rw-r--r--addons/network/network_view.xml298
-rw-r--r--addons/network/report/material.xml21
-rw-r--r--addons/network/report/material.xsl106
-rw-r--r--addons/network/report/network.xml41
-rw-r--r--addons/network/report/network.xsl143
-rw-r--r--addons/network/report/network_list.xml21
-rw-r--r--addons/network/report/network_list.xsl52
-rw-r--r--addons/partner_ldap/__init__.py2
-rw-r--r--addons/partner_ldap/__terp__.py13
-rw-r--r--addons/partner_ldap/partner.py39
-rw-r--r--addons/partner_ldap/wizard.xml7
-rw-r--r--addons/partner_ldap/wizard/__init__.py1
-rw-r--r--addons/partner_ldap/wizard/synchronize.py147
-rw-r--r--addons/product_electronic/__init__.py30
-rw-r--r--addons/product_electronic/__terp__.py13
-rw-r--r--addons/product_electronic/product_electronic.py53
-rw-r--r--addons/product_electronic/product_electronic_view.xml50
-rw-r--r--addons/product_expiry/__init__.py30
-rw-r--r--addons/product_expiry/__terp__.py13
-rw-r--r--addons/product_expiry/product_expiry.py73
-rw-r--r--addons/product_expiry/product_expiry_demo.xml128
-rw-r--r--addons/product_expiry/product_expiry_view.xml39
-rw-r--r--addons/product_extended/__init__.py1
-rw-r--r--addons/product_extended/__terp__.py12
-rw-r--r--addons/product_extended/product_extended.py138
-rw-r--r--addons/product_extended/product_extended_view.xml55
-rw-r--r--addons/product_variant/__init__.py30
-rw-r--r--addons/product_variant/__terp__.py12
-rw-r--r--addons/product_variant/product_variant.py84
-rw-r--r--addons/productivity_analysis/__init__.py32
-rw-r--r--addons/productivity_analysis/__terp__.py18
-rw-r--r--addons/productivity_analysis/productivity_analysis.py45
-rw-r--r--addons/productivity_analysis/productivity_analysis_report.xml11
-rw-r--r--addons/productivity_analysis/productivity_analysis_view.xml26
-rw-r--r--addons/productivity_analysis/productivity_analysis_wizard.xml18
-rw-r--r--addons/productivity_analysis/report/__init__.py29
-rw-r--r--addons/productivity_analysis/report/productivity_analysis.py150
-rw-r--r--addons/productivity_analysis/wizard/__init__.py29
-rw-r--r--addons/productivity_analysis/wizard/wizard_pa_report.py63
-rw-r--r--addons/purchase_discount/__init__.py2
-rw-r--r--addons/purchase_discount/__terp__.py11
-rw-r--r--addons/purchase_discount/purchase_discount.py94
-rw-r--r--addons/purchase_discount/purchase_discount_report.xml11
-rw-r--r--addons/purchase_discount/purchase_discount_view.xml27
-rw-r--r--addons/purchase_discount/report/__init__.py29
-rw-r--r--addons/purchase_discount/report/order.py88
-rw-r--r--addons/purchase_discount/report/order.rml2
-rw-r--r--addons/purchase_journal/__init__.py31
-rw-r--r--addons/purchase_journal/__terp__.py16
-rw-r--r--addons/purchase_journal/purchase_journal.py82
-rw-r--r--addons/purchase_journal/purchase_journal_data.xml7
-rw-r--r--addons/purchase_journal/purchase_journal_demo.xml6
-rw-r--r--addons/purchase_journal/purchase_journal_inherit.py52
-rw-r--r--addons/purchase_journal/purchase_journal_report.py73
-rw-r--r--addons/purchase_journal/purchase_journal_view.xml242
-rw-r--r--addons/purchase_tax_include/__init__.py29
-rw-r--r--addons/purchase_tax_include/__terp__.py14
-rw-r--r--addons/purchase_tax_include/purchase_tax_incl.py105
-rw-r--r--addons/purchase_tax_include/purchase_tax_incl.xml31
-rw-r--r--addons/sale_category/__init__.py0
-rw-r--r--addons/sale_category/__terp__.py0
-rw-r--r--addons/sale_category/report/__init__.py1
-rw-r--r--addons/sale_category/report/sale_category_report.py37
-rw-r--r--addons/sale_category/report/sale_category_report.rml3
-rw-r--r--addons/sale_category/sale.py0
-rw-r--r--addons/sale_category/sale_category_report.xml0
-rw-r--r--addons/sale_category/sale_category_view.xml0
-rw-r--r--addons/sale_crm/__init__.py29
-rw-r--r--addons/sale_crm/__terp__.py21
-rw-r--r--addons/sale_crm/sale_crm_wizard.xml6
-rw-r--r--addons/sale_crm/wizard/__init__.py30
-rw-r--r--addons/sale_crm/wizard/makesale.py116
-rw-r--r--addons/sale_journal/__init__.py32
-rw-r--r--addons/sale_journal/__terp__.py39
-rw-r--r--addons/sale_journal/picking_journal_view.xml130
-rw-r--r--addons/sale_journal/picking_journal_view_report.xml148
-rw-r--r--addons/sale_journal/sale_journal.py139
-rw-r--r--addons/sale_journal/sale_journal_data.xml12
-rw-r--r--addons/sale_journal/sale_journal_demo.xml18
-rw-r--r--addons/sale_journal/sale_journal_inherit.py78
-rw-r--r--addons/sale_journal/sale_journal_picking_report.py119
-rw-r--r--addons/sale_journal/sale_journal_report.py74
-rw-r--r--addons/sale_journal/sale_journal_view.xml300
-rw-r--r--addons/sale_rebate/__init__.py28
-rw-r--r--addons/sale_rebate/__terp__.py12
-rw-r--r--addons/sale_rebate/sale.py187
-rw-r--r--addons/sale_rebate/sale_view.xml72
-rw-r--r--addons/sale_tax_include/__init__.py29
-rw-r--r--addons/sale_tax_include/__terp__.py13
-rw-r--r--addons/sale_tax_include/sale_tax_incl.py110
-rw-r--r--addons/sale_tax_include/sale_tax_incl.xml30
-rw-r--r--addons/sandwich/__init__.py3
-rw-r--r--addons/sandwich/__terp__.py11
-rw-r--r--addons/sandwich/report/__init__.py1
-rw-r--r--addons/sandwich/report/sandwich_report.py42
-rw-r--r--addons/sandwich/report/sandwich_report.rml142
-rw-r--r--addons/sandwich/sandwich.py98
-rw-r--r--addons/sandwich/sandwich_demo.xml81
-rw-r--r--addons/sandwich/sandwich_report.xml11
-rw-r--r--addons/sandwich/sandwich_view.xml185
-rw-r--r--addons/sandwich/sandwich_wizard.xml15
-rw-r--r--addons/sandwich/wizard/__init__.py29
-rw-r--r--addons/sandwich/wizard/order_create.py79
-rw-r--r--addons/sandwich/wizard/sandwich_wizard.py128
-rw-r--r--addons/travel/10000000000000640000004BDD3CD5AB.gifbin6197 -> 0 bytes
-rw-r--r--addons/travel/__init__.py29
-rw-r--r--addons/travel/__terp__.py11
-rw-r--r--addons/travel/custom.py43
-rw-r--r--addons/travel/custom_report.xml11
-rw-r--r--addons/travel/custom_view.xml120
-rw-r--r--addons/travel/ticket.rml73
-rw-r--r--addons/users_ldap/__init__.py29
-rw-r--r--addons/users_ldap/__terp__.py18
-rw-r--r--addons/users_ldap/users_ldap.py140
-rw-r--r--addons/users_ldap/users_ldap_view.xml22
291 files changed, 0 insertions, 26161 deletions
diff --git a/addons/account_asset/__init__.py b/addons/account_asset/__init__.py
deleted file mode 100644
index 37483da67b5..00000000000
--- a/addons/account_asset/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import account_asset
-import account_asset_invoice
-import wizard
diff --git a/addons/account_asset/__terp__.py b/addons/account_asset/__terp__.py
deleted file mode 100644
index bf8b68c53fc..00000000000
--- a/addons/account_asset/__terp__.py
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name" : "Asset management",
- "version" : "1.0",
- "depends" : ["account", "account_simulation"],
- "author" : "Tiny",
- "description": """Financial and accounting asset management.""",
- "website" : "http://tinyerp.com/module_account.html",
- "category" : "Generic Modules/Accounting",
- "init_xml" : [
- ],
- "demo_xml" : [
- ],
- "update_xml" : [
- "account_asset_wizard.xml",
- "account_asset_view.xml",
- "account_asset_invoice_view.xml"
- ],
-# "translations" : {
-# "fr": "i18n/french_fr.csv"
-# },
- "active": False,
- "installable": True
-}
diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py
deleted file mode 100644
index f0beb50a26c..00000000000
--- a/addons/account_asset/account_asset.py
+++ /dev/null
@@ -1,331 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product.py 1310 2005-09-08 20:40:15Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-import time
-class account_asset_category(osv.osv):
- _name = 'account.asset.category'
- _description = 'Asset category'
- _columns = {
- 'name': fields.char('Asset category', size=64, required=True, select=1),
- 'code': fields.char('Asset code', size=16, select=1),
- 'note': fields.text('Note'),
- }
-account_asset_category()
-
-class account_asset_asset(osv.osv):
- _name = 'account.asset.asset'
- _description = 'Asset'
-
-# def _balance(self, cr, uid, ids, field_name, arg, context={}):
-# acc_set = ",".join(map(str, ids))
-# query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
-# cr.execute(("SELECT a.id, COALESCE(SUM((l.debit-l.credit)),0) FROM account_asset_asset a LEFT JOIN account_move_line l ON (a.id=l.asset_account_id) WHERE a.id IN (%s) and "+query+" GROUP BY a.id") % (acc_set,))
-# res = {}
-# for account_id, sum in cr.fetchall():
-# res[account_id] = round(sum,2)
-# for id in ids:
-# res[id] = round(res.get(id,0.0), 2)
-# return res
- def _get_period(self, cr, uid, context={}):
- print context
- periods = self.pool.get('account.period').find(cr, uid)
- if periods:
- return periods[0]
- else:
- return False
-
- def validate(self, cr, uid, ids, context={}):
- for asset in self.browse(cr, uid, ids, context):
- for prop in asset.property_ids:
- if prop.state=='draft':
- self.pool.get('account.asset.property').write(cr, uid, [prop.id], {'state':'open'}, context)
- return self.write(cr, uid, ids, {
- 'state':'normal'
- }, context)
-
- def _amount_total(self, cr, uid, ids, name, args, context={}):
- id_set=",".join(map(str,ids))
- cr.execute("""SELECT l.asset_id,abs(SUM(l.debit-l.credit)) AS amount FROM
- account_move_line l
- WHERE l.asset_id IN ("""+id_set+") GROUP BY l.asset_id ")
- res=dict(cr.fetchall())
- for id in ids:
- res.setdefault(id, 0.0)
- return res
- _columns = {
- 'name': fields.char('Asset', size=64, required=True, select=1),
- 'code': fields.char('Asset code', size=16, select=1),
- 'note': fields.text('Note'),
- 'category_id': fields.many2one('account.asset.category', 'Asset category', change_default=True),
- 'localisation': fields.char('Localisation', size=32, select=2),
- 'sequence': fields.integer('Sequence'),
- 'parent_id': fields.many2one('account.asset.asset', 'Parent asset'),
- 'child_ids': fields.one2many('account.asset.asset', 'parent_id', 'Childs asset'),
- 'date': fields.date('Date', required=True),
- 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'state': fields.selection([('view','View'),('draft','Draft'),('normal','Normal'),('close','Close')], 'Global state', required=True),
- 'active': fields.boolean('Active', select=2),
- 'partner_id': fields.many2one('res.partner', 'Partner'),
- 'entry_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
- 'property_ids': fields.one2many('account.asset.property', 'asset_id', 'Asset method name', readonly=True, states={'draft':[('readonly',False)]}),
- 'value_total': fields.function(_amount_total, method=True, digits=(16,2),string='Total value'),
- }
- _defaults = {
- 'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'account.asset.code'),
- 'date': lambda obj, cr, uid, context: time.strftime('%Y-%m-%d'),
- 'active': lambda obj, cr, uid, context: True,
- 'state': lambda obj, cr, uid, context: 'draft',
- 'period_id': _get_period,
- }
- def _compute_period(self, cr, uid, property, context={}):
- if (len(property.entry_asset_ids or [])/2)>=property.method_delay:
- return False
- if len(property.entry_asset_ids):
- cp = property.entry_asset_ids[-1].period_id
- cpid = self.pool.get('account.period').next(cr, uid, cp, property.method_period, context)
- current_period = self.pool.get('account.period').browse(cr, uid, cpid, context)
-
- else:
- current_period = property.asset_id.period_id
- return current_period
-
- def _compute_move(self, cr, uid, property, period, context={}):
- result = []
- total = 0.0
- for move in property.asset_id.entry_ids:
- total += move.debit-move.credit
- for move in property.entry_asset_ids:
- if move.account_id == property.account_asset_ids:
- total += move.debit-move.credit
- periods = (len(property.entry_asset_ids)/2) - property.method_delay
- if periods==1:
- amount = total
- else:
- if property.method == 'linear':
- amount = total / periods
- else:
- amount = total * property.method_progress_factor
-
- move_id = self.pool.get('account.move').create(cr, uid, {
- 'journal_id': property.journal_id.id,
- 'period_id': period.id,
- 'name': property.name or property.asset_id.name,
- 'ref': property.asset_id.code
- })
- result = [move_id]
- id = self.pool.get('account.move.line').create(cr, uid, {
- 'name': property.name or property.asset_id.name,
- 'move_id': move_id,
- 'account_id': property.account_asset_id.id,
- 'debit': amount>0 and amount or 0.0,
- 'credit': amount<0 and -amount or 0.0,
- 'ref': property.asset_id.code,
- 'period_id': period.id,
- 'journal_id': property.journal_id.id,
- 'partner_id': property.asset_id.partner_id.id,
- 'date': time.strftime('%Y-%m-%d'),
- })
- id2 = self.pool.get('account.move.line').create(cr, uid, {
- 'name': property.name or property.asset_id.name,
- 'move_id': move_id,
- 'account_id': property.account_actif_id.id,
- 'credit': amount>0 and amount or 0.0,
- 'debit': amount<0 and -amount or 0.0,
- 'ref': property.asset_id.code,
- 'period_id': period.id,
- 'journal_id': property.journal_id.id,
- 'partner_id': property.asset_id.partner_id.id,
- 'date': time.strftime('%Y-%m-%d'),
- })
- self.pool.get('account.asset.property').write(cr, uid, [property.id], {
- 'entry_asset_ids': [(4, id2, False),(4,id,False)]
- })
- if property.method_delay - (len(property.entry_asset_ids)/2)<=1:
- self.pool.get('account.asset.property')._close(cr, uid, property, context)
- return result
- return result
-
- def _compute_entries(self, cr, uid, asset, period_id, context={}):
- result = []
- date_start = self.pool.get('account.period').browse(cr, uid, period_id, context).date_start
- print 'compute entries', date_start
- for property in asset.property_ids:
- if property.state=='open':
- print 'Property State Open'
- period = self._compute_period(cr, uid, property, context)
- print period
- print period and period.date_start
- if period and (period.date_start<=date_start):
- result += self._compute_move(cr, uid, property, period, context)
- return result
-account_asset_asset()
-
-class account_asset_property(osv.osv):
- def _amount_total(self, cr, uid, ids, name, args, context={}):
- id_set=",".join(map(str,ids))
- cr.execute("""SELECT l.asset_id,abs(SUM(l.debit-l.credit)) AS amount FROM
- account_asset_property p
- left join
- account_move_line l on (p.asset_id=l.asset_id)
- WHERE p.id IN ("""+id_set+") GROUP BY l.asset_id ")
- res=dict(cr.fetchall())
- for id in ids:
- res.setdefault(id, 0.0)
- return res
-
- def _amount_residual(self, cr, uid, ids, name, args, context={}):
- id_set=",".join(map(str,ids))
- cr.execute("""SELECT
- r.asset_property_id,SUM(abs(l.debit-l.credit)) AS amount
- FROM
- account_move_asset_entry_rel r
- LEFT JOIN
- account_move_line l on (r.move_id=l.id)
- WHERE
- r.asset_property_id IN ("""+id_set+") GROUP BY r.asset_property_id ")
- res=dict(cr.fetchall())
- for prop in self.browse(cr, uid, ids, context):
- res[prop.id] = prop.value_total - res.get(prop.id, 0.0)
- for id in ids:
- res.setdefault(id, 0.0)
- return res
-
- def _close(self, cr, uid, property, context={}):
- if property.state<>'close':
- self.pool.get('account.asset.property').write(cr, uid, [property.id], {
- 'state': 'close'
- })
- property.state='close'
- ok = property.asset_id.state=='open'
- for prop in property.asset_id.property_ids:
- ok = ok and prop.state=='close'
- self.pool.get('account.asset.asset').write(cr, uid, [property.asset_id.id], {
- 'state': 'close'
- }, context)
- return True
-
- _name = 'account.asset.property'
- _description = 'Asset property'
- _columns = {
- 'name': fields.char('Method name', size=64, select=1),
- 'type': fields.selection([('direct','Direct'),('indirect','Indirect')], 'Depr. method type', select=2, required=True),
- 'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
- 'account_asset_id': fields.many2one('account.account', 'Asset account', required=True),
- 'account_actif_id': fields.many2one('account.account', 'Depreciation account', required=True),
- 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
- 'journal_analytic_id': fields.many2one('account.analytic.journal', 'Analytic journal'),
- 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
-
- 'method': fields.selection([('linear','Linear'),('progressif','Progressive')], 'Computation method', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'method_progress_factor': fields.float('Progressif factor', readonly=True, states={'draft':[('readonly',False)]}),
- 'method_time': fields.selection([('delay','Delay'),('end','Ending period')], 'Time method', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'method_delay': fields.integer('Number of interval', readonly=True, states={'draft':[('readonly',False)]}),
- 'method_period': fields.integer('Period per interval', readonly=True, states={'draft':[('readonly',False)]}),
- 'method_end': fields.date('Ending date'),
-
- 'date': fields.date('Date created'),
-
- 'entry_asset_ids': fields.many2many('account.move.line', 'account_move_asset_entry_rel', 'asset_property_id', 'move_id', 'Asset Entries'),
- 'board_ids': fields.one2many('account.asset.board', 'asset_id', 'Asset board'),
-
- 'value_total': fields.function(_amount_total, method=True, digits=(16,2),string='Gross value'),
- 'value_residual': fields.function(_amount_residual, method=True, digits=(16,2), string='Residual value'),
- 'state': fields.selection([('draft','Draft'), ('open','Open'), ('close','Close')], 'State', required=True),
- 'history_ids': fields.one2many('account.asset.property.history', 'asset_property_id', 'History', readonly=True)
- }
- _defaults = {
- 'type': lambda obj, cr, uid, context: 'direct',
- 'state': lambda obj, cr, uid, context: 'draft',
- 'method': lambda obj, cr, uid, context: 'linear',
- 'method_time': lambda obj, cr, uid, context: 'delay',
- 'method_progress_factor': lambda obj, cr, uid, context: 0.3,
- 'method_delay': lambda obj, cr, uid, context: 5,
- 'method_period': lambda obj, cr, uid, context: 12,
- 'date': lambda obj, cr, uid, context: time.strftime('%Y-%m-%d')
- }
-account_asset_property()
-
-class account_move_line(osv.osv):
- _inherit = 'account.move.line'
- _columns = {
- 'asset_id': fields.many2one('account.asset.asset', 'Asset'),
- }
-account_move_line()
-
-class account_asset_property_history(osv.osv):
- _name = 'account.asset.property.history'
- _description = 'Asset history'
- _columns = {
- 'name': fields.char('History name', size=64, select=1),
- 'user_id': fields.many2one('res.users', 'User', required=True),
- 'date': fields.date('Date', required=True),
- 'asset_property_id': fields.many2one('account.asset.property', 'Method', required=True),
- 'method_delay': fields.integer('Number of interval'),
- 'method_period': fields.integer('Period per interval'),
- 'method_end': fields.date('Ending date'),
- 'note': fields.text('Note'),
- }
- _defaults = {
- 'date': lambda *args: time.strftime('%Y-%m-%d'),
- 'user_id': lambda self,cr, uid,ctx: uid
- }
-account_asset_property_history()
-
-
-class account_asset_board(osv.osv):
- _name = 'account.asset.board'
- _description = 'Asset board'
- _columns = {
- 'name': fields.char('Asset name', size=64, required=True, select=1),
- 'asset_id': fields.many2one('account.asset.property', 'Asset', required=True, select=1),
- 'value_gross': fields.float('Gross value', required=True, select=1),
- 'value_asset': fields.float('Asset Value', required=True, select=1),
- 'value_asset_cumul': fields.float('Cumul. value', required=True, select=1),
- 'value_net': fields.float('Net value', required=True, select=1),
- }
- _auto = False
- def init(self, cr):
- cr.execute("""
- create or replace view account_asset_board as (
- select
- min(l.id) as id,
- min(l.id) as asset_id,
- 0.0 as value_gross,
- 0.0 as value_asset,
- 0.0 as value_asset_cumul,
- 0.0 as value_net
- from
- account_move_line l
- where
- l.state <> 'draft' and
- l.asset_id=3
- )""")
-account_asset_board()
-
diff --git a/addons/account_asset/account_asset_invoice.py b/addons/account_asset/account_asset_invoice.py
deleted file mode 100644
index b50cd3723b0..00000000000
--- a/addons/account_asset/account_asset_invoice.py
+++ /dev/null
@@ -1,54 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product.py 1310 2005-09-08 20:40:15Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-import time
-
-class account_invoice(osv.osv):
- _inherit = 'account.invoice'
- def line_get_convert(self, cr, uid, x, part, date, context={}):
- print self
- res = super(account_invoice, self).line_get_convert(cr, uid, x, part, date, context)
- res['asset_id'] = x.get('asset_id', False)
- return res
-account_invoice()
-
-class account_invoice_line(osv.osv):
- _inherit = 'account.invoice.line'
- _columns = {
- 'asset_id': fields.many2one('account.asset.asset', 'Asset'),
- }
- def move_line_get_item(self, cr, uid, line, context={}):
- res = super(account_invoice_line, self).move_line_get_item(cr, uid, line, context)
- res['asset_id'] = line.asset_id.id or False
- if line.asset_id.id and (line.asset_id.state=='draft'):
- self.pool.get('account.asset.asset').validate(cr, uid, [line.asset_id.id], context)
- return res
-account_invoice_line()
-
diff --git a/addons/account_asset/account_asset_invoice_view.xml b/addons/account_asset/account_asset_invoice_view.xml
deleted file mode 100644
index 5958893e670..00000000000
--- a/addons/account_asset/account_asset_invoice_view.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- #---------------------------------------------------------
- # Fiscal Year
- #---------------------------------------------------------
-
- <record model="ir.ui.view" id="view_account_invoice_asset_form">
- <field name="name">account.invoice.line.form</field>
- <field name="model">account.invoice.line</field>
- <field name="inherit_id" ref="account.view_invoice_line_form"/>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <field name="price_subtotal" position="after">
- <field name="asset_id" context="name=name"/>
- </field>
- </field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/account_asset/account_asset_view.xml b/addons/account_asset/account_asset_view.xml
deleted file mode 100644
index a9661e04a1a..00000000000
--- a/addons/account_asset/account_asset_view.xml
+++ /dev/null
@@ -1,278 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <record model="ir.ui.view" id="view_account_asset_category_form">
- <field name="name">account.asset.category.form</field>
- <field name="model">account.asset.category</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Asset category">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="note" colspan="4"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_asset_category_tree">
- <field name="name">account.asset.category.tree</field>
- <field name="model">account.asset.category</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Asset category">
- <field name="code"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_account_asset_category_form">
- <field name="name">Asset Category</field>
- <field name="res_model">account.asset.category</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Financial Management/Configuration/Assets/"
- id="menu_action_account_asset_category_form"
- action="action_account_asset_category_form"/>
-
-
- <record model="ir.ui.view" id="view_account_asset_property_tree">
- <field name="name">account.asset.property.tree</field>
- <field name="model">account.asset.property</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Assets methods">
- <field name="asset_id"/>
- <field name="name"/>
- <field name="journal_id"/>
- <field name="value_total"/>
- <field name="value_residual"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
-
-
-
- <record model="ir.ui.view" id="view_account_asset_asset_form">
- <field name="name">account.asset.asset.form</field>
- <field name="model">account.asset.asset</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Asset">
- <notebook>
- <page string="General info">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="period_id" select="2"/>
- <field name="category_id" select="1"/>
- <field name="property_ids" colspan="4" nolabel="1" mode="form,tree">
- <form string="Depreciation methods">
- <field name="name" select="1" colspan="4"/>
- <notebook string="Methods" tabpos="up" colspan="4">
- <page string="Depreciation">
- <separator string="Accounts information" colspan="4"/>
- <field name="account_asset_id"/>
- <field name="account_actif_id"/>
- <field name="journal_id"/>
- <field name="type"/>
- <field name="account_analytic_id"/>
- <field name="journal_analytic_id"/>
- <separator string="Depreciation duration" colspan="4"/>
- <field name="method"/>
- <field name="method_progress_factor"/>
- <field name="method_time"/>
- <field name="method_delay"/>
- <field name="method_period"/>
- <button
- name="%(wizard_asset_modify)d"
- states="open"
- string="Change duration"
- type="action"
- colspan="2"/>
- <!-- <field name="method_end"/> -->
- </page>
- <page string="Depreciation entries">
- <field name="entry_asset_ids" colspan="4" nolabel="1" readonly="1"/>
- </page>
- <page string="Change history">
- <field name="history_ids" colspan="4" nolabel="1" readonly="1"/>
- </page>
- <page string="Depreciation board">
- <field name="value_total"/>
- <field name="value_residual"/>
- </page>
- </notebook>
- <field name="state" readonly="1"/>
- <button name="%(wizard_asset_close)d" states="open" string="Close method" type="action"/>
- </form>
- </field>
- <field name="state" readonly="1"/>
- <group colspan="2" col="2">
- <button name="validate" states="draft" string="Confirm asset" type="object"/>
- </group>
- </page><page string="Entries">
- <field name="entry_ids" colspan="4" nolabel="1"/>
- </page><page string="Other information">
- <field name="date" select="2"/>
- <field name="sequence"/>
- <field name="partner_id" select="2"/>
- <field name="localisation" select="2"/>
- <field name="parent_id" select="2"/>
- <field name="note" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_asset_property_history_form">
- <field name="name">account.asset.property.history.form</field>
- <field name="model">account.asset.property.history</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Asset history">
- <field name="name" select="1"/>
- <field name="date" select="1"/>
- <field name="user_id" select="1"/>
- <field name="method_delay" select="2"/>
- <field name="method_period"/>
- <field name="method_end"/>
- <separator string="Notes" colspan="4"/>
- <field name="note" colspan="4" nolabel="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_asset_property_history_tree">
- <field name="name">account.asset.property.history.tree</field>
- <field name="model">account.asset.property.history</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Asset history">
- <field name="date" select="1"/>
- <field name="name" select="1"/>
- <field name="user_id" select="1"/>
- <field name="method_delay" select="2"/>
- <field name="method_period"/>
- <field name="method_end"/>
- </tree>
- </field>
- </record>
-
-
-
-
-
- <record model="ir.ui.view" id="view_account_asset_board_form">
- <field name="name">account.asset.board.form</field>
- <field name="model">account.asset.board</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Asset board">
- <field name="name" select="1"/>
- <field name="asset_id" select="1"/>
- <field name="value_gross" select="2"/>
- <field name="value_asset"/>
- <field name="value_asset_cumul"/>
- <field name="value_net"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_account_asset_board_tree">
- <field name="name">account.asset.board.tree</field>
- <field name="model">account.asset.board</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Asset board">
- <field name="name"/>
- <field name="asset_id"/>
- <field name="value_gross"/>
- <field name="value_asset"/>
- <field name="value_asset_cumul"/>
- <field name="value_net"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_asset_asset_tree">
- <field name="name">account.asset.asset.tree</field>
- <field name="model">account.asset.asset</field>
- <field name="type">tree</field>
- <field name="field_parent">child_ids</field>
- <field name="arch" type="xml">
- <tree string="Assets">
- <field name="name"/>
- <field name="code"/>
- <field name="value_total"/>
- <field name="date"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_account_asset_asset_form">
- <field name="name">Asset</field>
- <field name="res_model">account.asset.asset</field>
- <field name="view_type">form</field>
- </record>
- <menuitem
- name="Financial Management/Configuration/Assets/"
- id="menu_action_account_asset_asset_form"
- action="action_account_asset_asset_form"/>
-
- <record model="ir.actions.act_window" id="action_account_asset_asset_tree">
- <field name="name">Asset Hierarchy</field>
- <field name="res_model">account.asset.asset</field>
- <field name="view_type">tree</field>
- <field name="domain">[('parent_id','=',False)]</field>
- <field name="view_id" ref="view_account_asset_asset_tree"/>
- </record>
- <menuitem
- name="Financial Management/Assets/"
- id="menu_action_account_asset_asset_tree"
- action="action_account_asset_asset_tree"/>
-
- <record model="ir.actions.act_window" id="action_account_asset_asset_list">
- <field name="name">Assets</field>
- <field name="res_model">account.asset.asset</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
- <menuitem
- name="Financial Management/Assets/Assets"
- id="menu_action_account_asset_asset_list"
- action="action_account_asset_asset_list"/>
-
- <record model="ir.actions.act_window" id="action_account_asset_asset_list_draft">
- <field name="name">Draft Assets</field>
- <field name="res_model">account.asset.asset</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','draft')]</field>
- </record>
- <menuitem
- name="Financial Management/Assets/Assets/"
- id="menu_action_account_asset_asset_list_draft"
- action="action_account_asset_asset_list_draft"/>
-
-
- <record model="ir.actions.act_window" id="action_account_asset_asset_list_normal">
- <field name="name">Open Assets</field>
- <field name="res_model">account.asset.asset</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','normal')]</field>
- </record>
- <menuitem
- name="Financial Management/Assets/Assets/"
- id="menu_action_account_asset_asset_list_normal"
- action="action_account_asset_asset_list_normal"/>
-
-
-
-
-
-</data>
-</terp>
diff --git a/addons/account_asset/account_asset_wizard.xml b/addons/account_asset/account_asset_wizard.xml
deleted file mode 100644
index 6fd0beff02f..00000000000
--- a/addons/account_asset/account_asset_wizard.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <wizard
- string="Compute assets"
- model="account.asset.asset"
- name="account.asset.compute"
- keyword="tree_but_action"
- id="wizard_asset_compute"/>
- <menuitem
- name="Financial Management/Periodical Processing/Compute Assets"
- action="wizard_asset_compute"
- type="wizard"
- id="menu_wizard_asset_compute"/>
-
-
- <wizard
- string="Modify asset"
- model="account.asset.asset"
- name="account.asset.modify"
- id="wizard_asset_modify"
- menu="False"/>
- <wizard
- string="Close asset"
- model="account.asset.asset"
- name="account.asset.close"
- id="wizard_asset_close"
- menu="False"/>
- </data>
-</terp>
diff --git a/addons/account_asset/wizard/__init__.py b/addons/account_asset/wizard/__init__.py
deleted file mode 100644
index f00e8b67a10..00000000000
--- a/addons/account_asset/wizard/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_asset_compute
-import wizard_asset_close
-import wizard_asset_modify
diff --git a/addons/account_asset/wizard/wizard_asset_close.py b/addons/account_asset/wizard/wizard_asset_close.py
deleted file mode 100644
index 2016f76a28c..00000000000
--- a/addons/account_asset/wizard/wizard_asset_close.py
+++ /dev/null
@@ -1,56 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-asset_end_arch = '''<?xml version="1.0"?>
-<form string="Close asset">
- <separator string="General information" colspan="4"/>
-</form>'''
-
-asset_end_fields = {
-}
-
-class wizard_asset_close(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':asset_end_arch, 'fields':asset_end_fields, 'state':[
- ('end','Cancel'),
- ('asset_close','End of asset')
- ]}
- },
- 'asset_close': {
- 'actions': [],
- 'result': {'type' : 'state', 'state': 'end'}
- }
- }
-wizard_asset_close('account.asset.close')
-
-
diff --git a/addons/account_asset/wizard/wizard_asset_compute.py b/addons/account_asset/wizard/wizard_asset_compute.py
deleted file mode 100644
index cecec3fbf20..00000000000
--- a/addons/account_asset/wizard/wizard_asset_compute.py
+++ /dev/null
@@ -1,109 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-asset_end_arch = '''<?xml version="1.0"?>
-<form string="Compute assets">
- <separator string="Generated entries" colspan="4"/>
- <field name="move_ids" readonly="1" nolabel="1"/>
-</form>'''
-
-asset_end_fields = {
- 'move_ids': {'string':'Entries', 'type': 'one2many', 'relation':'account.move'},
-}
-
-
-asset_ask_form = '''<?xml version="1.0"?>
-<form string="Compute assets">
- <field name="period_id"/>
-</form>'''
-
-asset_ask_fields = {
- 'period_id': {'string': 'Period', 'type': 'many2one', 'relation':'account.period', 'required':True},
-}
-
-def _asset_compute(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- ass_obj = pool.get('account.asset.asset')
- ids = ass_obj.search(cr, uid, [('state','=','normal')], context)
- ids_create = []
- for asset in ass_obj.browse(cr, uid, ids, context):
- ids_create += ass_obj._compute_entries(cr, uid, asset, data['form']['period_id'], context)
- self.move_ids = ids_create
- return {'move_ids': ids_create}
-
-def _asset_open(self, cr, uid, data, context):
- value = {
- 'name': 'Created moves',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
- if data['form']['move_ids']:
- value['domain']= "[('id','in',["+','.join(map(str,self.move_ids))+"])]"
- else:
- value['domain']= "[('id','=', False)]"
- print value
- return value
-
-def _get_period(self, cr, uid, data, context={}):
- pool = pooler.get_pool(cr.dbname)
- ids = pool.get('account.period').find(cr, uid, context=context)
- period_id = False
- if len(ids):
- period_id = ids[0]
- return {'period_id': period_id}
-
-class wizard_asset_compute(wizard.interface):
- states = {
- 'init': {
- 'actions': [_get_period],
- 'result': {'type':'form', 'arch':asset_ask_form, 'fields':asset_ask_fields, 'state':[
- ('end','Cancel'),
- ('asset_compute','Compute assets')
- ]}
- },
- 'asset_compute': {
- 'actions': [_asset_compute],
- 'result': {'type' : 'form', 'arch': asset_end_arch, 'fields':asset_end_fields, 'state':[
- ('end','Close'),
- ('asset_open','Open entries')
- ]}
- },
- 'asset_open': {
- 'actions': [],
- 'result': {'type':'action', 'action': _asset_open, 'state':'end'}
- }
- }
-wizard_asset_compute('account.asset.compute')
-
-
diff --git a/addons/account_asset/wizard/wizard_asset_modify.py b/addons/account_asset/wizard/wizard_asset_modify.py
deleted file mode 100644
index 25b987012b5..00000000000
--- a/addons/account_asset/wizard/wizard_asset_modify.py
+++ /dev/null
@@ -1,93 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-asset_end_arch = '''<?xml version="1.0"?>
-<form string="Modify asset">
- <separator string="Asset properties to modify" colspan="4"/>
- <field name="name" colspan="4"/>
- <field name="method_delay"/>
- <field name="method_period"/>
- <separator string="Notes" colspan="4"/>
- <field name="note" nolabel="1" colspan="4"/>
-</form>'''
-
-asset_end_fields = {
- 'name': {'string':'Reason', 'type':'char', 'size':64, 'required':True},
- 'method_delay': {'string':'Number of interval', 'type':'float'},
- 'method_period': {'string':'Period per interval', 'type':'float'},
- 'note': {'string':'Notes', 'type':'text'},
-}
-
-def _asset_default(self, cr, uid, data, context={}):
- pool = pooler.get_pool(cr.dbname)
- prop = pool.get('account.asset.property').browse(cr, uid, data['id'], context)
- return {
- 'name': prop.name,
- 'method_delay': prop.method_delay,
- 'method_period': prop.method_period
- }
-
-def _asset_modif(self, cr, uid, data, context={}):
- pool = pooler.get_pool(cr.dbname)
- prop = pool.get('account.asset.property').browse(cr, uid, data['id'], context)
- print prop
- pool.get('account.asset.property.history').create(cr, uid, {
- 'asset_property_id': data['id'],
- 'name': prop.name,
- 'method_delay': prop.method_delay,
- 'method_period': prop.method_period,
- 'note': data['form']['note'],
- }, context)
- pool.get('account.asset.property').write(cr, uid, [data['id']], {
- 'name': data['form']['name'],
- 'method_delay': data['form']['method_delay'],
- 'method_period': data['form']['method_period'],
- }, context)
- return {}
-
-
-class wizard_asset_modify(wizard.interface):
- states = {
- 'init': {
- 'actions': [_asset_default],
- 'result': {'type':'form', 'arch':asset_end_arch, 'fields':asset_end_fields, 'state':[
- ('end','Cancel'),
- ('asset_modify','Modify asset')
- ]}
- },
- 'asset_modify': {
- 'actions': [_asset_modif],
- 'result': {'type' : 'state', 'state': 'end'}
- }
- }
-wizard_asset_modify('account.asset.modify')
-
-
diff --git a/addons/account_cash_discount/__init__.py b/addons/account_cash_discount/__init__.py
deleted file mode 100644
index db89eddac5b..00000000000
--- a/addons/account_cash_discount/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import account_cash_discount
diff --git a/addons/account_cash_discount/__terp__.py b/addons/account_cash_discount/__terp__.py
deleted file mode 100644
index eaaa6a37363..00000000000
--- a/addons/account_cash_discount/__terp__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "Payement Term with Cash Discount",
- "version" : "1.0",
- "depends" : ["account",],
- "author" : "Tiny",
- "description" : "",
- "website" : "http://tinyerp.com/",
- "category" : "Generic Modules/Accounting",
- "description": """
- This module adds cash discounts on payment terms. Cash discounts
- for a payment term can be configured with:
- * A number of days,
- * A discount (%),
- * A debit and a credit account
- """,
- "init_xml" : [
- ],
- "demo_xml" : [
- ],
- "update_xml" : [
- "account_cash_discount_view.xml",
- ],
- "active": False,
- "installable": True
-}
diff --git a/addons/account_cash_discount/account_cash_discount.py b/addons/account_cash_discount/account_cash_discount.py
deleted file mode 100644
index 85a36ec6659..00000000000
--- a/addons/account_cash_discount/account_cash_discount.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-import mx.DateTime
-from mx.DateTime import RelativeDateTime
-
-class account_payment_term(osv.osv):
- _name = "account.payment.term"
- _inherit = "account.payment.term"
- _columns = {
- 'cash_discount_ids': fields.one2many('account.cash.discount', 'payment_id', 'Cash Discounts'),
- }
- def get_discounts(self,cr,uid,id,base_date, context={}):
- """
- return the list of (date,percentage) ordered by date for the
- payment term with the corresponding id. return [] if no cash
- discount are defined. base_date is the date from where the
- discounts are computed.
- """
-
- pt = self.browse(cr, uid, id, context)
-
- if not pt.cash_discount_ids:
- return []
-
- res=[]
- for d in pt.cash_discount_ids:
- res.append(
- ((mx.DateTime.strptime(base_date,'%Y-%m-%d') +\
- RelativeDateTime(days=d.delay+1)).strftime("%Y-%m-%d"),
- d.discount)
- )
-
- res.sort(cmp=lambda x,y: cmp(x[0],y[0]))
- return res
-account_payment_term()
-
-class account_cash_discount(osv.osv):
- _name = "account.cash.discount"
- _description = "Cash Discount" #A reduction in the price if payment is made within a stipulated period.
- _columns = {
- 'name': fields.char('Name', size=32),
- 'delay': fields.integer('Number of Days', required=True),
- 'discount': fields.float('Discount (%)', digits=(16,6),required=True),
- 'payment_id': fields.many2one('account.payment.term','Associated Payment Term'),
- 'credit_account_id': fields.many2one('account.account', 'Credit Account'),
- 'debit_account_id': fields.many2one('account.account', 'Debit Account'),
- }
-account_cash_discount()
-
diff --git a/addons/account_cash_discount/account_cash_discount_view.xml b/addons/account_cash_discount/account_cash_discount_view.xml
deleted file mode 100644
index bb029d0bb2f..00000000000
--- a/addons/account_cash_discount/account_cash_discount_view.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <!-- cash discount -->
-
-
- <record model="ir.ui.view" id="view_cash_discount_form">
- <field name="name">account.cash.discount.form</field>
- <field name="model">account.cash.discount</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Cash Discount">
- <field name="name" select="1"/>
- <field name="delay" select="1"/>
- <field name="discount" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_cash_discount_tree">
- <field name="name">account.cash.discount.tree</field>
- <field name="model">account.cash.discount</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Cash Discount" editable="bottom">
- <field name="name" select="1"/>
- <field name="delay" select="1"/>
- <field name="discount" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_payment_term_form">
- <field name="name">account.payment.term.form</field>
- <field name="model">account.payment.term</field>
- <field name="inherit_id" ref="account.view_payment_term_form"/>
- <field name="arch" type="xml">
- <field name="line_ids" position="after">
- <field name="cash_discount_ids" colspan="4"/>
- <separator string="Cash Discount" colspan="4"/>
- </field>
- </field>
- </record>
-
- </data>
-</terp>
diff --git a/addons/account_simulation/__init__.py b/addons/account_simulation/__init__.py
deleted file mode 100644
index 7f788840b1a..00000000000
--- a/addons/account_simulation/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import account_simulation
-import wizard
diff --git a/addons/account_simulation/__terp__.py b/addons/account_simulation/__terp__.py
deleted file mode 100644
index d1912f0d7cf..00000000000
--- a/addons/account_simulation/__terp__.py
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name" : "Accounting simulation journal",
- "version" : "1.0",
- "depends" : ["account"],
- "author" : "Tiny",
- "description": """Accounting simulation plan.""",
- "website" : "http://tinyerp.com/module_account.html",
- "category" : "Generic Modules/Accounting",
- "init_xml" : [
- ],
- "demo_xml" : [
- "account_simulation_demo.xml"
- ],
- "update_xml" : [ "account_simulation_view.xml" ],
-# "translations" : {
-# "fr": "i18n/french_fr.csv"
-# },
- "active": False,
- "installable": True
-}
diff --git a/addons/account_simulation/account_simulation.py b/addons/account_simulation/account_simulation.py
deleted file mode 100644
index a373d926ae8..00000000000
--- a/addons/account_simulation/account_simulation.py
+++ /dev/null
@@ -1,90 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-
-class account_journal_simulation(osv.osv):
- _name = "account.journal.simulation"
- _description = "Simulation level"
- _columns = {
- 'name': fields.char('Simulation name', size=32, required=True),
- 'code': fields.char('Simulation code', size=8, required=True),
- }
- _sql_constraints = [
- ('code_uniq', 'unique (code)', 'The code of the simulation must be unique !')
- ]
- _order = "name"
-account_journal_simulation()
-
-def _state_simul_get(self, cr, uid, context={}):
- obj = self.pool.get('account.journal.simulation')
- ids = obj.search(cr, uid, [])
- res = obj.read(cr, uid, ids, ['code', 'name'], context)
- return [('valid','Base')]+ [(r['code'], r['name']) for r in res]
-
-class account_journal(osv.osv):
- _inherit = "account.journal"
- _columns = {
- 'state': fields.selection(_state_simul_get, 'Status', required=True),
- 'parent_ids': fields.many2many('account.journal', 'account_journal_simulation_rel', 'journal_src_id', 'journal_dest_id', 'Childs journal'),
- 'child_ids': fields.many2many('account.journal', 'account_journal_simulation_rel', 'journal_dest_id', 'journal_src_id', 'Parent journal'),
- }
- _defaults = {
- 'state': lambda self,cr,uid,context: 'valid'
- }
-account_journal()
-
-class account_move_line(osv.osv):
- _inherit = "account.move.line"
- def search_not_run(self, cr, uid, crit, offset=0, limit=None, order=None, context={}):
- if not 'fiscalyear' in context:
- context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid)
- ok = True
- for c in crit:
- if c[0]=='journal_id':
- ok = False
- break
- if 'journal_id' in context:
- ok=False
- if ok:
- plus = ''
- for state in context.get('journal_state', []):
- plus+=",'"+state+"'"
- cr.execute("select id from account_journal where state in ('valid'"+plus+")")
- crit.append(('journal_id', 'in', map(lambda x: x[0], cr.fetchall())))
- res = super(account_move_line, self).search(cr, uid, crit, offset, limit, order, context)
- return res
-
- def _query_get(self, cr, uid, obj='l', context={}):
- res = super(account_move_line, self)._query_get(cr, uid, obj, context)
- if context.get('journal_state', []):
- plus = " and (l.journal_id in (select id from account_journal where state in ('valid', "+','.join(map(lambda x: "'"+x+"'", context['journal_state']))+")))"
- else:
- plus = " and (l.journal_id in (select id from account_journal where state='valid'))"
- return res+plus
-account_move_line()
diff --git a/addons/account_simulation/account_simulation_demo.xml b/addons/account_simulation/account_simulation_demo.xml
deleted file mode 100644
index 341c6ddb5cf..00000000000
--- a/addons/account_simulation/account_simulation_demo.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
- <!--
- Journal Simulation
- -->
-
- <record model="account.journal.simulation" id="journal_sim0">
- <field name="name">Simulation Level 0</field>
- <field name="code">sim0</field>
- </record>
-
-</data>
-</terp>
-
diff --git a/addons/account_simulation/account_simulation_view.xml b/addons/account_simulation/account_simulation_view.xml
deleted file mode 100644
index eb73c7df7bd..00000000000
--- a/addons/account_simulation/account_simulation_view.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <record model="ir.ui.view" id="view_account_journal_simulation_tree">
- <field name="name">account.journal.simulation.tree</field>
- <field name="model">account.journal.simulation</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Journal simulation">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_journal_simulation_form">
- <field name="name">account.journal.simulation.form</field>
- <field name="model">account.journal.simulation</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Journal simulation">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_view_account_journal_simulation_form">
- <field name="name">Journal Simulations</field>
- <field name="res_model">account.journal.simulation</field>
- <field name="view_type">form</field>
- </record>
- <menuitem
- name="Financial Management/Configuration/Journal/"
- id="menu_action_view_account_journal_simulation_form"
- action="action_view_account_journal_simulation_form"/>
-
- <record model="ir.ui.view" id="view_account_journal_form_inherit_simul">
- <field name="name">account.journal.simulation.form.inherit</field>
- <field name="model">account.journal</field>
- <field name="inherit_id" ref="account.view_account_journal_form"/>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <field name="update_posted" position="after">
- <field name="state"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_account_journal_tree">
- <field name="name">account.journal.tree</field>
- <field name="model">account.journal</field>
- <field name="type">tree</field>
- <field name="field_parent">child_ids</field>
- <field name="arch" type="xml">
- <tree string="Account Journal">
- <field name="code"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_account_journal_tree">
- <field name="name">Account Journal</field>
- <field name="res_model">account.journal</field>
- <field name="view_type">tree</field>
- </record>
- <menuitem
- name="Financial Management/Configuration/Journal/Journal Architecture"
- id="menu_action_account_journal_tree"
- action="action_account_journal_tree"/>
-
- <wizard string="Accounts Charts" menu="False" model="account.account" name="account.simulation.chart" id="account.wizard_account_chart"/>
-
-</data>
-</terp>
-
diff --git a/addons/account_simulation/wizard/__init__.py b/addons/account_simulation/wizard/__init__.py
deleted file mode 100644
index 3fe34298151..00000000000
--- a/addons/account_simulation/wizard/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_account_chart
diff --git a/addons/account_simulation/wizard/wizard_account_chart.py b/addons/account_simulation/wizard/wizard_account_chart.py
deleted file mode 100644
index dc0c50fce8f..00000000000
--- a/addons/account_simulation/wizard/wizard_account_chart.py
+++ /dev/null
@@ -1,81 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-class wizard_account_chart(wizard.interface):
- _account_chart_arch = '''<?xml version="1.0"?>
- <form string="Account charts">
- <field name="fiscalyear"/>
- <separator string="Simulations" colspan="4"/>
- <field name="states" colspan="4" nolabel="1"/>
- </form>'''
-
- _account_chart_fields = {
- 'fiscalyear': {'string': 'Fiscal year', 'type':'many2one','relation': 'account.fiscalyear', 'required': True },
- 'states': {'string':'States', 'type':'many2many', 'relation':'account.journal.simulation'},
- }
-
- def _get_defaults(self, cr, uid, data, context):
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- return data['form']
-
-
- def _account_chart_open_window(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
- act_obj = pool.get('ir.actions.act_window')
-
- result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id])[0]
-
- ctx = {'fiscalyear': data['form']['fiscalyear']}
-
-
- if data['form']['states']:
- ctx['journal_state']=[]
- sim_obj = pooler.get_pool(cr.dbname).get('account.journal.simulation')
- for a in sim_obj.read(cr, uid, data['form']['states'][0][2], ['code'], context):
- ctx['journal_state'].append(a['code'])
- result['context'] = str(ctx)
- return result
-
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type': 'form', 'arch':_account_chart_arch, 'fields':_account_chart_fields, 'state': [('end', 'Cancel'), ('open', 'Open Charts')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action':_account_chart_open_window, 'state':'end'}
- }
- }
-wizard_account_chart('account.simulation.chart')
diff --git a/addons/airport/1000000000000144000000689888B27C.gif b/addons/airport/1000000000000144000000689888B27C.gif
deleted file mode 100644
index 3bd305cbaf9..00000000000
--- a/addons/airport/1000000000000144000000689888B27C.gif
+++ /dev/null
Binary files differ
diff --git a/addons/airport/__init__.py b/addons/airport/__init__.py
deleted file mode 100644
index 3ab61a52eeb..00000000000
--- a/addons/airport/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import custom
diff --git a/addons/airport/__terp__.py b/addons/airport/__terp__.py
deleted file mode 100644
index 6082e8b4ff4..00000000000
--- a/addons/airport/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Airport",
- "author" : "Tiny",
- "version" : "1.0",
- "depends" : ["base", "product"],
- "description": "Sample module to manage airport, flights and hostels",
- "init_xml" : [],
- "update_xml" : ["custom_view.xml", "custom_report.xml"],
- "category" : "Enterprise Specific Modules/Travel Agencies",
- "active": False,
- "installable": False
-}
diff --git a/addons/airport/custom.py b/addons/airport/custom.py
deleted file mode 100644
index 57dde589b1c..00000000000
--- a/addons/airport/custom.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from osv import osv, fields
-
-class airport_airport(osv.osv):
- _name = 'airport.airport'
- _columns = {
- 'name': fields.char('Airport name', size=16),
- 'city': fields.char('City', size=16),
- 'country_id': fields.many2one('res.country', 'Country'),
- 'lines': fields.many2many('airport.airport', 'airport_airport_lines_rel', 'source','destination', 'Flight lines')
- }
-airport_airport()
-
-class airport_flight(osv.osv):
- _name = 'airport.flight'
- _inherit = 'product.product'
- _table = 'product_product'
- _columns = {
- 'date': fields.datetime('Departure Date'),
- 'partner_id': fields.many2one('res.partner', 'Customer'),
- 'airport_from': fields.many2one('airport.airport', 'Airport Departure'),
- 'airport_to': fields.many2one('airport.airport', 'Airport Arrival'),
- }
-airport_flight()
-
diff --git a/addons/airport/custom_report.xml b/addons/airport/custom_report.xml
deleted file mode 100644
index 822cf94f9ac..00000000000
--- a/addons/airport/custom_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report
- string="Custom Ticket"
- model="airport.flight"
- name="airport flight"
- rml="airport/ticket.rml"
- />
- </data>
-</terp>
diff --git a/addons/airport/custom_view.xml b/addons/airport/custom_view.xml
deleted file mode 100644
index e203d790046..00000000000
--- a/addons/airport/custom_view.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<terp>
-<data>
-
- <record model="ir.actions.act_window" id="action_airport_form">
- <field name="res_model">airport.airport</field>
- </record>
- <menuitem name="Airports/Configuration/Airport" id="menu_action_airport_form" action="action_airport_form"/>
-
-
- <record model="ir.ui.view" id="v3">
- <field name="name">airport.airport</field>
- <field name="model">airport.airport</field>
- <field name="type">tree</field>
- <field name="field_parent">lines</field>
- <field name="arch" type="xml">
- <tree string="Flight">
- <field name="name"/>
- <field name="city"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_custom_airport_tree">
- <field name="res_model">airport.airport</field>
- <field name="view_type">tree</field>
- </record>
- <menuitem name="Airports/Air Lines" id="menu_action_custom_airport_tree" action="action_custom_airport_tree"/>
-
-
- <record model="ir.ui.view" id="v4">
- <field name="name">airport.airport</field>
- <field name="model">airport.airport</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Flight">
- <field name="name" colspan="4" select="1"/>
- <field name="city" select="1" />
- <field name="country_id" select="1" />
- <field name="lines" colspan="4"/>
- </form>
- </field>
- </record>
-
-
- <record model="ir.actions.act_window" id="action_custom_flight_form">
- <field name="res_model">airport.flight</field>
- </record>
- <menuitem name="Airports/Configuration/Flights" id="menu_action_custom_flight_form" action="action_custom_flight_form"/>
- <record model="ir.ui.view" id="v2">
- <field name="name">airport.flight</field>
- <field name="model">airport.flight</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Flight">
- <field name="name" select="1"/>
- <field name="date" select="1" />
- <field name="categ_id" select="1" />
- <field name="partner_id" select="1" />
- <field name="airport_from" select="1" />
- <field name="airport_to" select="1" />
- </form>
- </field>
- </record>
-
-</data>
-</terp>
-
diff --git a/addons/airport/ticket.rml b/addons/airport/ticket.rml
deleted file mode 100644
index d7b1638967b..00000000000
--- a/addons/airport/ticket.rml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- <blockBackground colorName="#9999cc" start="1,0" stop="1,0"/>
- <blockBackground colorName="#ccccff" start="0,1" stop="0,1"/>
- <blockBackground colorName="#ccccff" start="1,1" stop="1,1"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P2" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P3" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P4" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P5" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P6" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P8" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Standard" fontName="Times-Roman"/>
- <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman"/>
- </stylesheet>
- <story>
- <para style="Standard">[[ repeatIn(objects,'o') ]]</para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="241.0,241.0" repeatRows="1" style="Table1">
- <tr>
- <td>
- <illustration height="75.0" width="235.0">
- <image x="0" y="0" file="1000000000000144000000689888B27C.gif" height="75.0" width="235.0"/>
- </illustration>
- </td>
- <td>
- <para style="P1">TO: [[ o.partner_id.name ]]</para>
- <para style="P2">[[ o.partner_id.address[0].name ]]</para>
- <para style="P3">
- <font color="white"> </font>
- </para>
- <para style="P4">
- <font color="white"> </font>
- </para>
- <para style="P5">This ticket can be be reimbursed.See sales</para>
- <para style="P5">conditions in your travel agency contract.</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P6">Departure:</para>
- <para style="P7">[[ o.airport_from.name ]]</para>
- <para style="P7">[[ o.airport_from.country_id.name ]]</para>
- </td>
- <td>
- <para style="P8">Arrival:</para>
- <para style="P7">[[ o.airport_to.name ]]</para>
- <para style="P7">[[ o.airport_to.country_id.name ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </story>
-</document>
-
diff --git a/addons/airport/ticket.sxw b/addons/airport/ticket.sxw
deleted file mode 100644
index f816ee6f13c..00000000000
--- a/addons/airport/ticket.sxw
+++ /dev/null
Binary files differ
diff --git a/addons/analytic_partners/__init__.py b/addons/analytic_partners/__init__.py
deleted file mode 100644
index 413735b9503..00000000000
--- a/addons/analytic_partners/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import analytic_partners
-import report
-
diff --git a/addons/analytic_partners/__terp__.py b/addons/analytic_partners/__terp__.py
deleted file mode 100644
index 5d6f6a279d7..00000000000
--- a/addons/analytic_partners/__terp__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "Analytic accounts with multiple partners",
- "author" : "Tiny",
- "version" : "1.0",
- "category" : "Generic Modules/Others",
- "depends" : ["account"],
- "description": """
- This module adds the possibility to assign multiple partners on
- the same analytic account. It's usefull when you do a management
- by affairs, where you can attach all suppliers and customers to
- a project.
-
- A report for the project manager is added to print the analytic
- account and all associated partners with their contacts.
-
- It's usefull to give to all members of a project, so that they
- get the contacts of all suppliers in this project.
- """,
- "demo_xml" : [],
- "update_xml" : ["analytic_partners_view.xml",
- "analytic_partners_report.xml"],
- "init_xml" : [],
- "active": False,
- "installable": True
-}
diff --git a/addons/analytic_partners/analytic_partners.py b/addons/analytic_partners/analytic_partners.py
deleted file mode 100644
index 907e9d499fb..00000000000
--- a/addons/analytic_partners/analytic_partners.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from osv import osv, fields
-
-class analytic_partners_account_analytic_account(osv.osv) :
- _name = 'account.analytic.account'
- _inherit = 'account.analytic.account'
- _columns = {
- 'address_ids' : fields.many2many('res.partner.address', 'account_partner_rel', 'account_id', 'address_id', 'Partners Contacts'),
- }
-
-analytic_partners_account_analytic_account()
diff --git a/addons/analytic_partners/analytic_partners_report.xml b/addons/analytic_partners/analytic_partners_report.xml
deleted file mode 100644
index 29d8ac76415..00000000000
--- a/addons/analytic_partners/analytic_partners_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<terp>
-<data>
-<report id="analytic_partners_report"
- string="Analytic Account with Partners"
- model="account.analytic.account"
- name="analytic_partners.print"
- rml="analytic_partners/report/analytic_account_partners.rml"
- auto="False"
- />
-</data>
-</terp>
diff --git a/addons/analytic_partners/analytic_partners_view.xml b/addons/analytic_partners/analytic_partners_view.xml
deleted file mode 100644
index bb914ba0914..00000000000
--- a/addons/analytic_partners/analytic_partners_view.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<terp>
-<data>
- <record model="ir.ui.view" id="analytic_partners_analytic_account_form">
- <field name="name">analytic_partners.analytic.account.form</field>
- <field name="model">account.analytic.account</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="account.view_account_analytic_account_form"/>
- <field name="arch" type="xml">
- <notebook>
- <page string="Partners">
- <field colspan="4" name="address_ids"/>
- </page>
- </notebook>
- </field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/analytic_partners/report/__init__.py b/addons/analytic_partners/report/__init__.py
deleted file mode 100644
index dca93c184c5..00000000000
--- a/addons/analytic_partners/report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import analytic_partners_report
diff --git a/addons/analytic_partners/report/analytic_account_partners.rml b/addons/analytic_partners/report/analytic_account_partners.rml
deleted file mode 100644
index 7931292989e..00000000000
--- a/addons/analytic_partners/report/analytic_account_partners.rml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="35.0" y1="48.0" width="525" height="746"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table3">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
- <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
- <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
- <blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
- <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
- <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
- </blockTableStyle>
- <blockTableStyle id="Table1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- <blockBackground colorName="#ffffcc" start="0,0" stop="0,0"/>
- </blockTableStyle>
- <blockTableStyle id="Table2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8"/>
- <paraStyle name="P2" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER"/>
- <paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
- <paraStyle name="P4" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT"/>
- <paraStyle name="P6" fontName="Times-Roman"/>
- <paraStyle name="P7" fontName="Times-Roman" fontSize="6.0" leading="8"/>
- <paraStyle name="P8" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="P9" fontName="Times-Roman"/>
- <paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14"/>
- <paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
- <paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
- <paraStyle name="Standard" fontName="Times-Roman"/>
- <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Times-Roman"/>
- <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman"/>
- </stylesheet>
- <story>
- <para style="P1">[[repeatIn(objects, 'o')]]</para>
- <blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table3">
- <tr>
- <td>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="P2">Partner listing</para>
- </td>
- <td>
- <para style="P3">Printed: [[ time.strftime('%d-%m-%Y') ]]</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="Table Contents">[[ company.name ]]</para>
- </td>
- <td>
- <para style="P4">[[ o['name'] ]]</para>
- </td>
- <td>
- <para style="P5">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="P6">[[ _init_dict(o) ]]</para>
- <section>
- <para style="P7">[[ repeatIn(partners_by_account.keys(), 'cat') ]]</para>
- <blockTable colWidths="525.0" style="Table1">
- <tr>
- <td>
- <para style="P8">[[ cat ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="P6">
- <font color="white"> </font>
- </para>
- <section>
- <para style="P9"><font face="Times-Roman">[[ repeatIn(partners_by_account[cat], 'p') ]] </font>[[ p.name ]] - [[ p.vat ]]</para>
- <blockTable colWidths="186.0,169.0,169.0" style="Table2">
- <tr>
- <td>
- <para style="Table Contents">Contact</para>
- </td>
- <td>
- <para style="Table Contents">Address</para>
- </td>
- <td>
- <para style="Table Contents">Information</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P10"><font face="Times-Roman">[[ repeatIn(p.address, 'a') ]] </font>[[ a.name ]]</para>
- <para style="P11">[[ a.function ]]</para>
- </td>
- <td>
- <para style="P10">[[ a.street ]] [[ a.street2 ]]</para>
- <para style="P10">[[ a.zip ]] [[ a.city ]]</para>
- <para style="P10">[[ a.country_id and a.country_id.name ]]</para>
- </td>
- <td>
- <para style="P10"><font face="Times-Roman">Tel</font> : [[ a.phone ]]</para>
- <para style="P10"><font face="Times-Roman">Fax</font> : [[ a.fax ]]</para>
- <para style="P10"><font face="Times-Roman">Mobile</font> : [[ a.mobile ]]</para>
- <para style="P12">Mail<font face="Times-Roman"> : [[ a.email ]]</font></para>
- </td>
- </tr>
- </blockTable>
- <para style="P6">
- <font color="white"> </font>
- </para>
- </section>
- </section>
- </story>
-</document>
-
diff --git a/addons/analytic_partners/report/analytic_partners_report.py b/addons/analytic_partners/report/analytic_partners_report.py
deleted file mode 100644
index 7a154ab2b49..00000000000
--- a/addons/analytic_partners/report/analytic_partners_report.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import pooler
-import time
-from report import report_sxw
-
-class analytic_partners_report(report_sxw.rml_parse):
- # o must be an instance of
- # analytic_partners_account_analytic_account.
- def _init_dict(self, o):
- self.partners_by_account.clear()
- for a in o.address_ids:
- p = a.partner_id
- for c in p.category_id:
- self.partners_by_account.setdefault(c.name, []).append(a)
- if not p.category_id:
- self.partners_by_account.setdefault('Non classifie', []).append(a)
-
-
- def __init__(self, cr, uid, name, context):
- # self.partners_by_account is a dictionnary where keys are category
- # names and values are lists of partner_id.
- self.partners_by_account={}
- super(analytic_partners_report, self).__init__(cr, uid, name, context)
- self.localcontext.update( {
- 'time' : time,
- '_init_dict' : self._init_dict,
- 'partners_by_account' : self.partners_by_account,
- } )
-
-report_sxw.report_sxw(
- 'report.analytic_partners.print',
- 'account.analytic.account',
- 'addons/analytic_partners/report/analytic_account_partners.rml',
- parser=analytic_partners_report)
diff --git a/addons/audittrail/__init__.py b/addons/audittrail/__init__.py
deleted file mode 100644
index b357716d295..00000000000
--- a/addons/audittrail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import audittrail
diff --git a/addons/audittrail/__terp__.py b/addons/audittrail/__terp__.py
deleted file mode 100644
index f328e0dfad5..00000000000
--- a/addons/audittrail/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "Audit Trail",
- "website" : "http://tinyerp.com",
- "author" : "Tiny",
- "version" : "1.0",
- "depends" : ["base"],
- "init_xml" : [],
- "description": "Allows the administrator to track every user operations on all objects of the system.",
- "category" : "Generic Modules/Others",
- "update_xml" : ["audittrail_view.xml"],
- "demo_xml" : ["audittrail_demo.xml"],
- "active" : False,
- "installable": False
-}
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
deleted file mode 100644
index 7b196ac69b2..00000000000
--- a/addons/audittrail/audittrail.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*- coding :utf-8 -*-
-
-from osv import osv, fields
-import time, pooler, copy
-
-class audittrail_rule(osv.osv):
- _name = 'audittrail.rule'
- _columns = {
- "name": fields.char("Rule Name", size=32, required=True),
- "object_id": fields.many2one('ir.model', 'Object', required=True),
- "user_id": fields.many2many('res.users', 'audittail_rules_users', 'user_id', 'rule_id', 'Users'),
- "log_read": fields.boolean("Log reads"),
- "log_write": fields.boolean("Log writes"),
- "log_unlink": fields.boolean("Log deletes"),
- "log_create": fields.boolean("Log creates"),
- "state": fields.selection((("draft", "Draft"),("subscribed", "Subscribed")), "State", required=True)
- }
- _defaults = {
- 'state': lambda *a: 'draft',
- 'log_create': lambda *a: 1,
- 'log_unlink': lambda *a: 1,
- 'log_write': lambda *a: 1,
- }
- __functions = {}
-
- def subscribe(self, cr, uid, ids, *args):
- for thisrule in self.browse(cr, uid, ids):
- obj = self.pool.get(thisrule.object_id.model)
- if not obj:
- print ("%s WARNING:audittrail:%s is not part of the pool -- change audittrail depends -- setting rule: %s as DRAFT" % (time.strftime('%a, %d %b %Y %H:%M:%S'), thisrule.object_id.model, thisrule.name))
- self.write(cr, uid, ids, {"state": "draft"})
- return False
- for field in ('read','write','create','unlink'):
- if getattr(thisrule, 'log_'+field):
- # backup corresponding method
- self.__functions.setdefault(thisrule.id, [])
- self.__functions[thisrule.id].append( (obj, field, getattr(obj,field)) )
- uids_to_log = []
- for user in thisrule.user_id:
- uids_to_log.append(user.id)
- # override it with the logging variant
- setattr(obj, field, self.logging_fct(getattr(obj,field), thisrule.object_id, uids_to_log))
- self.write(cr, uid, ids, {"state": "subscribed"})
- return True
-
- def logging_fct(self, fct_src, object, logged_uids):
- if object.model=="audittrail.log":
- return fct_src
- def my_fct( cr, uid, *args, **args2):
- if not len(logged_uids) or uid in logged_uids:
- self.pool.get('audittrail.log').create(cr, uid, {"method": fct_src.__name__, "object_id": object.id, "user_id": uid, "args": "%s, %s" % (str(args), str(args2)), "name": "%s %s %s" % (fct_src.__name__, object.id, time.strftime("%Y-%m-%d %H:%M:%S"))})
- return fct_src( cr, uid, *args, **args2)
- return my_fct
-
- def unsubscribe(self, cr, uid, ids, *args):
- for thisrule in self.browse(cr, uid, ids):
- for function in self.__functions[thisrule.id]:
- setattr(function[0], function[1], function[2])
- self.write(cr, uid, ids, {"state": "draft"})
- return True
-
-# def __init__(self, *args):
-# super(audittrail_rule, self).__init__(*args)
-# cr = pooler.db.cursor()
-#FIXME: ah merde, ca craint pour le multi-db! Une solution serait d'overrider d'office toutes les methodes
-# et de checker dans la methode elle meme s'il faut logger ou pas, mais ca risque de tout faire ramer violemment
-# une autre solution (bien meilleure, il me semble) est de rajouter une méthode "db_dependant_init" dans osv qui est overridable
-# et appellée dans le __init__ de osv (comme creation des tables et chargement des données)
-# a merde, ca marche pas, vu que plusieurs utilisateurs peuvent etre sur des bases differentes en meme temps
-# self.subscribe(cr, 1, self.search(cr, 1, [('state','=','subscribed')]))
-# cr.commit()
-# cr.close()
-# del cr
-
-class audittrail_log(osv.osv):
- _name = 'audittrail.log'
- _columns = {
- "name": fields.char("Name", size=32),
- "object_id": fields.many2one('ir.model', 'Object'),
- "user_id": fields.many2one('res.users', 'User'),
- "method": fields.selection((('read', 'Read'), ('write', 'Write'), ('unlink', 'Delete'), ('create', 'Create')), "Method"),
- "args": fields.text("Arguments"),
- "timestamp": fields.datetime("Timestamp")
- }
- _defaults = {
- "timestamp": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S")
- }
-
-audittrail_log()
-audittrail_rule()
-
-
diff --git a/addons/audittrail/audittrail_demo.xml b/addons/audittrail/audittrail_demo.xml
deleted file mode 100644
index c39cbcb1a11..00000000000
--- a/addons/audittrail/audittrail_demo.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data noupdate="1">
- <record model="audittrail.rule" id="demo_audittrail_rule">
- <field name="name">Audit on Partners</field>
- <field name="object_id" search="[('model','=','res.partner')]"/>
- <field name="user_id" search="[]"/>
- </record>
- </data>
-</terp>
diff --git a/addons/audittrail/audittrail_view.xml b/addons/audittrail/audittrail_view.xml
deleted file mode 100644
index 537dc99e39a..00000000000
--- a/addons/audittrail/audittrail_view.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <record model="ir.ui.view" id="view_audittrail_rule_form">
- <field name="name">audittrail.rule.form</field>
- <field name="model">audittrail.rule</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="AuditTrail Rule">
- <field name="name" select="1" required="1"/>
- <field name="object_id" select="1"/>
- <field name="log_read" />
- <field name="log_write" />
- <field name="log_unlink" />
- <field name="log_create" />
- <field name="user_id" select="1" colspan="4"/>
- <field name="state" select="1" readonly="1" />
- <group colspan="2" col="2">
- <button string="Subscribe" name="subscribe" type="object" states="draft"/>
- <button string="UnSubscribe" name="unsubscribe" type="object" states="subscribed"/>
- </group>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_audittrail_rule_tree">
- <field name="name">audittrail.rule.tree</field>
- <field name="model">audittrail.rule</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="AuditTrail Rules">
- <field name="name" />
- <field name="object_id" />
- <field name="user_id" />
- <field name="log_read" />
- <field name="log_write" />
- <field name="log_unlink" />
- <field name="log_create" />
- <field name="state" />
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_audittrail_rule_tree">
- <field name="res_model">audittrail.rule</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_audittrail_rule_form" />
- </record>
- <menuitem name="Administration/Audittrails/Rules" id="menu_action_audittrail_rule_tree" action="action_audittrail_rule_tree"/>
-
- <record model="ir.actions.act_window" id="action_audittrail_rule_tree_sub">
- <field name="res_model">audittrail.rule</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','subscribed')]</field>
- </record>
- <menuitem name="Administration/Audittrails/Rules/Subscribed Rules" id="menu_action_audittrail_rule_tree_sub" action="action_audittrail_rule_tree_sub"/>
-
- <record model="ir.ui.view" id="view_audittrail_log_form">
- <field name="name">audittrail.log.form</field>
- <field name="model">audittrail.log</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="AuditTrail Logs">
- <field name="timestamp" select="1" required="1" readonly="1"/>
- <field name="object_id" select="1" readonly="1"/>
- <field name="method" select="1" readonly="1"/>
- <field name="user_id" select="1" readonly="1"/>
- <field name="args" select="1" readonly="1" colspan="4"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_audittrail_log_tree">
- <field name="name">audittrail.log.tree</field>
- <field name="model">audittrail.log</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="AuditTrail Logs">
- <field name="timestamp" />
- <field name="object_id" />
- <field name="method" />
- <field name="user_id" />
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_audittrail_log_tree">
- <field name="res_model">audittrail.log</field>
- <field name="view_type">form</field>
- </record>
- <menuitem name="Administration/Audittrails/Logs" id="menu_action_audittrail_log_tree" action="action_audittrail_log_tree"/>
-</data>
-</terp>
diff --git a/addons/base_partner_relation/__init__.py b/addons/base_partner_relation/__init__.py
deleted file mode 100644
index 602a838bbc0..00000000000
--- a/addons/base_partner_relation/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: partner.py 1007 2005-07-25 13:18:09Z kayhman $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-
-import partner_relation
diff --git a/addons/base_partner_relation/__terp__.py b/addons/base_partner_relation/__terp__.py
deleted file mode 100644
index 3c7d6cbea86..00000000000
--- a/addons/base_partner_relation/__terp__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name" : "Partners - relation extension",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/CRM & SRM",
- "description" : """Add a tab in the partner form to encode relations between several partners.
- For eg, the partner 'Toubib and Co.' has different contacts.
- When 'Toubib and Co.' orders, you have to deliver to 'Toubib - Belgium'
- and invoice to 'Toubib - Geneva'.
- """,
- "depends" : ["base"],
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : [
- "partner_relation_view.xml",
- ],
- "active": False,
- "installable": True
-}
diff --git a/addons/base_partner_relation/partner_relation.py b/addons/base_partner_relation/partner_relation.py
deleted file mode 100644
index 9bfce670879..00000000000
--- a/addons/base_partner_relation/partner_relation.py
+++ /dev/null
@@ -1,78 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: partner.py 1007 2005-07-25 13:18:09Z kayhman $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class res_partner_relation(osv.osv):
- _description='The partner object'
- _name = "res.partner.relation"
- _columns = {
- 'name': fields.selection( [ ('default','Default'),('invoice','Invoice'), ('delivery','Delivery'), ('contact','Contact'), ('other','Other') ],'Relation Type', required=True),
- 'partner_id': fields.many2one('res.partner', 'Main Partner', required=True, ondelete='cascade'),
- 'relation_id': fields.many2one('res.partner', 'Relation Partner', required=True, ondelete='cascade')
- }
- _defaults = {
- 'name' : lambda *a: 'invoice',
- }
-res_partner_relation()
-
-class res_partner(osv.osv):
- _description='The partner object'
- _inherit = "res.partner"
- _columns = {
- 'relation_ids': fields.one2many('res.partner.relation', 'partner_id', 'Relations')
- }
-
- def _is_related_to(self, cr, uid, ids, toid):
- related=[]
- for id in ids:
- cr.execute("select id from res_partner_relation where (partner_id=%s and relation_id=%s) or (partner_id=%s and relation_id=%s)" % (id,toid,toid,id))
- res=cr.fetchone()
- if res and len(res):
- related.append(True)
- else:
- related.append(False)
- return related
-
- def address_get(self, cr, uid, ids, adr_pref=['default']):
- todo = []
- result = {}
- cr.execute('select name,relation_id from res_partner_relation where partner_id in ('+','.join(map(str,ids))+')')
- adrs = dict(cr.fetchall())
- for adr in adr_pref:
- if adr in adrs:
- adr_prov = super(res_partner, self).address_get(cr, uid, [adrs[adr]], [adr]).values()[0]
- result[adr] = adr_prov
- else:
- todo.append(adr)
- if len(todo):
- result.update(super(res_partner, self).address_get(cr, uid, ids, todo))
- return result
-res_partner()
-
diff --git a/addons/base_partner_relation/partner_relation_view.xml b/addons/base_partner_relation/partner_relation_view.xml
deleted file mode 100644
index ba686f88058..00000000000
--- a/addons/base_partner_relation/partner_relation_view.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <!--
- Partner Relations
- -->
-
- <record model="ir.ui.view" id="view_partner_relation_form">
- <field name="name">res.partner.relation.form</field>
- <field name="model">res.partner.relation</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Relations">
- <field name="name" />
- <newline/>
- <field name="relation_id"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_partner_relation_tree">
- <field name="name">res.partner.relation.tree</field>
- <field name="model">res.partner.relation</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Relations">
- <field name="name" />
- <field name="relation_id"/>
- </tree>
- </field>
- </record>
-
- <!--
- Partners Extension
- -->
-
- <record model="ir.ui.view" id="view_partner_form">
- <field name="name">res.partner.form.inherit</field>
- <field name="model">res.partner</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="base.view_partner_form"/>
- <field name="arch" type="xml">
- <notebook>
- <page string="Relations">
- <field name="relation_ids" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/base_partner_sequence/__init__.py b/addons/base_partner_sequence/__init__.py
deleted file mode 100644
index fa11d59fa8a..00000000000
--- a/addons/base_partner_sequence/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import partner_sequence
diff --git a/addons/base_partner_sequence/__terp__.py b/addons/base_partner_sequence/__terp__.py
deleted file mode 100644
index 68eba35ae52..00000000000
--- a/addons/base_partner_sequence/__terp__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Use the custom module to put your specific code in a separate module.
-#
-{
- "name" : "Add an automatic sequence on partners",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Base",
- "website": "http://www.tinyerp.com",
- "depends" : ["base"],
- "description": """
- This module adds the possibility to define a sequence for
- the partner code. This code is then set as default when you
- create a new partner, using the defined sequence.
- """,
- "demo_xml" : [],
- "init_xml" : ['partner_sequence.xml'],
- "update_xml" : [],
- "active": False,
- "installable": True
-}
diff --git a/addons/base_partner_sequence/partner_sequence.py b/addons/base_partner_sequence/partner_sequence.py
deleted file mode 100644
index 91ff8272af2..00000000000
--- a/addons/base_partner_sequence/partner_sequence.py
+++ /dev/null
@@ -1,40 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-
-class partner_sequence(osv.osv):
- _inherit = 'res.partner'
- def create(self, cr, uid, vals, context={}):
- vals['ref'] = self.pool.get('ir.sequence').get(cr, uid, 'res.partner')
- res = super(partner_sequence, self).create(cr, uid, vals, context)
- return res
- _columns = {
- 'ref': fields.char('Code', size=64, readonly=True),
- }
-partner_sequence()
diff --git a/addons/base_partner_sequence/partner_sequence.xml b/addons/base_partner_sequence/partner_sequence.xml
deleted file mode 100644
index 518fa027892..00000000000
--- a/addons/base_partner_sequence/partner_sequence.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
- #
- # Sequences for res.partner
- #
-
- <record model="ir.sequence.type" id="seq_type_res_partner">
- <field name="name">Partner code</field>
- <field name="code">res.partner</field>
- </record>
- <record model="ir.sequence" id="seq_res_partner">
- <field name="name">Partner code</field>
- <field name="code">res.partner</field>
- <field name="prefix">P/</field>
- <field name="padding">5</field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/edi/__init__.py b/addons/edi/__init__.py
deleted file mode 100644
index 638f911dcde..00000000000
--- a/addons/edi/__init__.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sale_cust_price
-import partner
-
-from edi import *
-
-import wizard
-
-
diff --git a/addons/edi/__terp__.py b/addons/edi/__terp__.py
deleted file mode 100644
index f6648313c88..00000000000
--- a/addons/edi/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "EDI",
- "version" : "1.0",
- "author" : "Tiny",
- "depends" : ["sale"],
- "category" : "Interfaces/EDI",
- 'description': "Used for the communication with others proprietary ERP's. Has been tested in the food industries process, communicating with SAP. This module is able to import order and export delivery notes.",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["edi_wizard.xml", "edi_view.xml", "edi_data.xml", "sale_cust_price.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/edi/data/README b/addons/edi/data/README
deleted file mode 100644
index c07c5f400c5..00000000000
--- a/addons/edi/data/README
+++ /dev/null
@@ -1,10 +0,0 @@
-À mettre dans /edi/reception !
-
-Ajouter les EAN aux partenaires et aux produits et le packaging
-
-Commandes SQL pour les menus:
-
- * Produit qui disparaissent :
- UPDATE ir_ui_menu SET parent_id = 169 WHERE id = 172
-
-
diff --git a/addons/edi/data/edi/reception/encours/COMMANDE.202894 b/addons/edi/data/edi/reception/encours/COMMANDE.202894
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/edi/data/edi/reception/encours/COMMANDE.202894
+++ /dev/null
diff --git a/addons/edi/data/edi/reception/encours/COMMANDE.203271 b/addons/edi/data/edi/reception/encours/COMMANDE.203271
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/edi/data/edi/reception/encours/COMMANDE.203271
+++ /dev/null
diff --git a/addons/edi/data/edi/reception/encours/COMMANDE.TXT b/addons/edi/data/edi/reception/encours/COMMANDE.TXT
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/edi/data/edi/reception/encours/COMMANDE.TXT
+++ /dev/null
diff --git a/addons/edi/data/edi/reception/encours/COMMANDE.lec1 b/addons/edi/data/edi/reception/encours/COMMANDE.lec1
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/edi/data/edi/reception/encours/COMMANDE.lec1
+++ /dev/null
diff --git a/addons/edi/edi.py b/addons/edi/edi.py
deleted file mode 100644
index 93c0c4118f9..00000000000
--- a/addons/edi/edi.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import time
-import netsvc
-from osv import fields,osv,orm
-import ir
-from mx import DateTime
-
-
-class edi_log(osv.osv):
- _name = "edi.log"
- _description = "EDI log"
- _columns = { 'name': fields.char('Log name', size=32, required=True),
- 'log_line': fields.one2many('edi.log.line', 'log_id', 'Log Lines', readonly=True, states={'draft':[('readonly', False)]}),
- }
-
- _defaults = { 'name': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
- }
-
-edi_log()
-
-
-class edi_log_line(osv.osv):
- _name = "edi.log.line"
- _description = "EDI Log Line"
- _columns = { 'log_id': fields.many2one('edi.log', 'Log Ref'),
- 'name': fields.char('Name', size=64, required=True),
- 'logdesc': fields.text('Description'),
- 'sender': fields.many2one('res.partner', 'Partner', readonly=True),
- 'timestamp': fields.char('Order date', size=13),
- 'order_num': fields.char('Edi Order Id', size=15),
- }
- _defaults = { 'name': lambda *a: 'logline',
- }
-
-edi_log_line()
-
diff --git a/addons/edi/edi_data.xml b/addons/edi/edi_data.xml
deleted file mode 100644
index 1f5104014fd..00000000000
--- a/addons/edi/edi_data.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data noupdate="1">
- <record id="edi_request" model="res.request.link">
- <field name="name">EDI Log</field>
- <field name="object">edi.log</field>
- </record>
-
- <record model="product.pricelist.type" id="pricelist_type_sale">
- <field name="name">Customer Pricelist</field>
- <field name="key">edi_customer</field>
- </record>
-
- <record model="ir.property" id="property_product_pricelist_customer" forcecreate="True">
- <field name="name">property_product_pricelist_customer</field>
- <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist_customer')]"/>
- <field name="value" eval="False"/>
- </record>
- </data>
-</terp>
diff --git a/addons/edi/edi_view.xml b/addons/edi/edi_view.xml
deleted file mode 100644
index 039009eb1d3..00000000000
--- a/addons/edi/edi_view.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="ir.ui.view" id="view_edi_log_line">
- <field name="name">edi.log.line.tree</field>
- <field name="model">edi.log.line</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree>
- <field name="order_num"/>
- <field name="timestamp"/>
- <field name="sender"/>
- <field name="logdesc"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_edi_tree">
- <field name="name">edi.log.tree</field>
- <field name="model">edi.log</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="EDI Logs">
- <field name="name"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_edi_form">
- <field name="name">edi.log.form</field>
- <field name="model">edi.log</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="EDI Logs">
- <field name="name" select="1"/>
- <newline/>
- <field name="log_line" widget="one2many_list" colspan="4" nolabel="1"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_edi_tree">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">edi.log</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="view_id" eval="False" />
- </record>
- <menuitem name="Sales Management/Edi/View Logs" action="action_edi_tree" id="menu_edi_log"/>
-
-</data>
-</terp>
diff --git a/addons/edi/edi_wizard.xml b/addons/edi/edi_wizard.xml
deleted file mode 100644
index 6771a8074ad..00000000000
--- a/addons/edi/edi_wizard.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <wizard string="Import EDI Sales" model="sale.order" name="edi.import" id="wizard_edi_import"/>
- <menuitem name="Sales Management/Edi/Import Edi Sales Orders" action="wizard_edi_import" type="wizard"/>
- <wizard string="Export EDI Sales" model="sale.order" name="edi.import" id="wizard_edi_export"/>
- <menuitem name="Sales Management/Edi/Export Edi Sales Orders" action="wizard_edi_export" type="wizard"/>
- </data>
-</terp>
-
diff --git a/addons/edi/partner.py b/addons/edi/partner.py
deleted file mode 100644
index 1e7e5583006..00000000000
--- a/addons/edi/partner.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-
-class res_partner(osv.osv):
- _name = 'res.partner'
- _inherit = 'res.partner'
- _columns = {
- 'property_product_pricelist_customer': fields.property(
- 'product.pricelist',
- type='many2one',
- relation='product.pricelist',
- string="Customer Pricelist",
- method=True,
- view_load=True,
- group_name="Pricelists Properties"),
- }
-res_partner()
-
diff --git a/addons/edi/report/import-results.xml b/addons/edi/report/import-results.xml
deleted file mode 100644
index 2b5d411677a..00000000000
--- a/addons/edi/report/import-results.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0"?>
diff --git a/addons/edi/report/import-results.xsl b/addons/edi/report/import-results.xsl
deleted file mode 100644
index 1a06f8e6cef..00000000000
--- a/addons/edi/report/import-results.xsl
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:template match="/">
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/addons/edi/sale_cust_price.py b/addons/edi/sale_cust_price.py
deleted file mode 100644
index 95873ea6ae6..00000000000
--- a/addons/edi/sale_cust_price.py
+++ /dev/null
@@ -1,45 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv,orm
-
-
-class sale_order(osv.osv):
- _inherit = 'sale.order'
- _columns = {
- 'customer_pricelist_id':fields.many2one('product.pricelist', 'Customer Pricelist'),
- }
-sale_order()
-
-class sale_order_line(osv.osv):
- _inherit = 'sale.order.line'
- _columns = {
- 'price_unit_customer': fields.float('Customer Unit Price'),
- }
-sale_order_line()
-
diff --git a/addons/edi/sale_cust_price.xml b/addons/edi/sale_cust_price.xml
deleted file mode 100644
index 09b5fcf2390..00000000000
--- a/addons/edi/sale_cust_price.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="ir.ui.view" id="view_sale_order">
- <field name="name">sale.order.form.pvc</field>
- <field name="model">sale.order</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="sale.view_order_form"/>
- <field name="arch" type="xml">
- <field name="client_order_ref" position="after">
- <field name="customer_pricelist_id" />
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_sale_order_line">
- <field name="name">sale.order.line.form.pvc</field>
- <field name="model">sale.order.line</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="sale.view_order_form"/>
- <field name="arch" type="xml">
- <field name="price_unit" position="after">
- <field name="price_unit_customer"/>
- </field>
- </field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/edi/wizard/__init__.py b/addons/edi/wizard/__init__.py
deleted file mode 100644
index 7854096df8d..00000000000
--- a/addons/edi/wizard/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_edi_import
diff --git a/addons/edi/wizard/edi_exchange.py b/addons/edi/wizard/edi_exchange.py
deleted file mode 100644
index 79a89006d37..00000000000
--- a/addons/edi/wizard/edi_exchange.py
+++ /dev/null
@@ -1,127 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-def stripnulls(data):
- return data.replace("\00", "").strip()
-
-def fillleft(data, length):
- while len(str(data))<length:
- data=" "+str(data)
- return data
-
-def fillright(data, length):
- while len(str(data))<length:
- data=str(data)+" "
- return data
-
-def fillzero(data, length):
- while len(str(data))<length:
- data="0"+str(data)
- return data
-
-class edi_exchange:
-
- hint_struct = { "sender": ( 4, 39, stripnulls, fillright),
- "receiver": ( 57, 92, stripnulls, fillright),
- "date": ( 110, 118, stripnulls, fillright),
- "time": ( 118, 122, stripnulls, fillleft),
- }
-
- hgen_struct = { "message-type": ( 32, 43, stripnulls, fillright),
- "order-num": ( 43, 78, stripnulls, fillright),
- "order-date": ( 78, 86, stripnulls, fillright),
- "currency": ( 101, 104, stripnulls, fillright),
- }
-
- hpty_struct = { "partner-type": ( 4, 7, stripnulls, fillright),
- "partner-code": ( 7, 24, stripnulls, fillright),
- }
-
- hdel_struct = { "deliv-date": ( 4, 12, stripnulls, fillright),
- "deliv-time": ( 12, 16, stripnulls, fillright),
- "deliv-q": ( 16, 19, stripnulls, fillright),
- }
-
- hftx_struct = { "text-q": ( 4, 7, stripnulls, fillright),
- "text": ( 7, 209, stripnulls, fillright),
- }
-
- dftx_struct = { "text-q": ( 4, 7, stripnulls, fillright),
- "text": ( 7, 209, stripnulls, fillright),
- }
-
- dart_struct = { "line-num": ( 4, 10, stripnulls, fillzero),
- "barcode": ( 13, 48, stripnulls, fillright),
- "quantity21": ( 89, 104, stripnulls, fillzero),
- "unit21": ( 107, 110, stripnulls, fillright),
- "quantity59": ( 110, 125, stripnulls, fillzero),
- "unit59": ( 128, 131, stripnulls, fillright),
- "price": ( 131, 146, stripnulls, fillzero),
- "price-q": ( 146, 149, stripnulls, fillright),
- "price-unit": ( 149, 152, stripnulls, fillright),
- "hint-price": ( 152, 167, stripnulls, fillright),
- "hint-price-q": ( 167, 170, stripnulls, fillright),
- "hint-price-u": ( 170, 173, stripnulls, fillright),
- "ref86": ( 173, 181, stripnulls, fillright),
- "shop-code": ( 181, 196, stripnulls, fillright),
- "item-key": ( 196, 209, stripnulls, fillright),
- "shop-key": ( 209, 215, stripnulls, fillright),
- "log-unit-num": ( 215, 220, stripnulls, fillright),
- }
-
- dpty_struct = { "shop-barcode": ( 7, 24, stripnulls, fillright),
- }
-
- ddel_struct = { "deliv-date": ( 4, 12, stripnulls, fillright),
- "deliv-time": ( 12, 16, stripnulls, fillright),
- }
-
- dpid_struct = { "ident-art": ( 7, 42, stripnulls, fillright),
- }
-
- def parse_line(cls, line):
- lineDict = {}
- if hasattr(cls,line[:4].lower()+"_struct"):
- for field, tuple in getattr(cls,line[:4].lower()+"_struct").items():
- start, end, parseFunc, writeFunc = tuple
- lineDict[field] = parseFunc(line[start:end])
- return line[:4], lineDict
- else:
- return line[:4], {}
-
- parse_line = classmethod(parse_line)
-
- def create_line(cls, line):
- lineDict = {}
- outline=line['type'].upper()+" "*250+"\r\n"
- if hasattr(cls,line['type'].lower()+"_struct"):
- for field, tuple in getattr(cls, line['type'].lower()+"_struct").items():
- start, end, parseFunc, writeFunc = tuple
- outline=outline[0:start]+writeFunc(line[field], end-start)+outline[end:]
- return outline
-
- create_line = classmethod(create_line)
diff --git a/addons/edi/wizard/wizard_edi_export.py b/addons/edi/wizard/wizard_edi_export.py
deleted file mode 100644
index 6c0cbe3f5b3..00000000000
--- a/addons/edi/wizard/wizard_edi_export.py
+++ /dev/null
@@ -1,69 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: wizard_edi_export.py 2071 2006-01-09 16:37:25Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-
-_export_form = '''<?xml version="1.0"?>
-<form string="EDI file export">
- <separator string="Export to the following directory" colspan="4" />
- <field name="ediexportdir" colspan="4" />
-</form>'''
-
-_export_fields = { 'ediexportdir' : { 'string' : 'EDI Import Dir',
- 'type' : 'char',
- 'size' : 100,
- 'default' : lambda *a: '/edi/reception',
- 'required' : True
- },
- }
-
-_export_done_form = '''<?xml version="1.0"?>
-<form string="EDI file exported">
- <separator string="EDI file exported" colspan="4" />
-</form>'''
-
-_export_done_fields = {}
-
-def _do_export(self, cr, uid, data, context):
- return {}
-
-class wiz_edi_export(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : { 'type' : 'form', 'arch' : _import_form, 'fields' : _import_fields, 'state' : (('end', 'Cancel'),('export', 'Export Sales') )},
- },
- 'export' : {
- 'actions' : [_do_export],
- 'result' : { 'type' : 'form', 'arch' : _export_done_form, 'fields' : _export_done_fields, 'state' : (('end', 'Ok'),)},
- },
- }
-
-wiz_edi_export('edi.export')
-# vim:noexpandtab:
diff --git a/addons/edi/wizard/wizard_edi_import.py b/addons/edi/wizard/wizard_edi_import.py
deleted file mode 100644
index 2cf75f9af38..00000000000
--- a/addons/edi/wizard/wizard_edi_import.py
+++ /dev/null
@@ -1,488 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: wizard_edi_import.py 1825 2005-12-13 11:04:20Z ede $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import ir
-import time
-import os
-from edi_exchange import edi_exchange
-
-import wizard
-from osv import osv
-import pooler
-
-_import_form = '''<?xml version="1.0"?>
-<form string="EDI file import">
- <separator string="Import the following files" colspan="4" />
- <field name="ediimportdir" colspan="4" />
- <field name="current" />
- <field name="error" />
-</form>'''
-
-_import_fields = { 'ediimportdir' : { 'string' : 'EDI Import Dir',
- 'type' : 'char',
- 'size' : 100,
- 'default' : lambda *a: '/edi/reception',
- 'required' : True
- },
- 'current' : { 'string' : 'Current',
- 'type' : 'boolean',
- 'default' : lambda *a: True,
- },
- 'error' : { 'string' : 'Error',
- 'type' : 'boolean',
- 'default' : lambda *a: False,
- },
- }
-
-_import_done_form = '''<?xml version="1.0"?>
-<form string="EDI file imported">
- <separator string="EDI file imported" colspan="4" />
-</form>'''
-
-_import_done_fields = {}
-
-def _child_of_partner(cr, uid, child, parent):
- if child==parent:
- return True
- direct_parent_list=pooler.get_pool(cr.dbname).get('res.partner').read(cr, uid, [child], ['parent_id'])
- #print str(direct_parent_list)
- if len(direct_parent_list)!=1:
- return False
- if not direct_parent_list[0]['parent_id']:
- return False
- direct_parent=direct_parent_list[0]['parent_id'][0]
- if direct_parent and direct_parent!='':
- return _child_of_partner( cr, uid, direct_parent, parent)
- else:
- return False
-
-def _prepare_import(self, cr, uid, data, context):
- files=[]
- for (type, dir) in [('current', 'encours'), ('error', 'erreur')]:
- if (data['form'][type]):
- edi_path = os.path.join(data['form']['ediimportdir'], dir)
- if not os.path.isdir(edi_path):
- os.makedirs(edi_path)
- for file in os.listdir(edi_path):
- #print file[:9]
- if file[:9]=="COMMANDE.":
- files.append((file, os.path.join(data['form']['ediimportdir'], dir, file)))
- for (filename, file) in files:
- #print "Importing %s" % filename
- FirstInt=True
- FirstOrd=True
- sr = {'sender':None, 'receiver':None}
- sale_orders = []
- log_id=pooler.get_pool(cr.dbname).get('edi.log').create(cr, uid, {})
- logline=pooler.get_pool(cr.dbname).get('edi.log.line')
- logline.create(cr, uid, {
- 'log_id': log_id,
- 'logdesc': "Checking %s" % filename,
- })
- try:
- status= edi_status()
- fh = open(file, "r")
- for line in fh:
- line_type, line_content = edi_exchange.parse_line(line)
- if line_type == "HINT":
- if not FirstInt:
- sale_orders.append(sale_order_o)
- FirstOrd=True
- sale_order_o = sale_order(cr, uid, sr)
- elif line_type == "HPTY":
- if not FirstOrd:
- FirstInt=False
- elif line_type == "DART":
- FirstOrd=False
-
- sale_order_o.parse_line(line_type, line_content, status)
-
- sale_orders.append(sale_order_o)
-
- finally:
- fh.close()
-
- for (order_id, order_timestamp, sender, message) in status.messages:
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "\t%s" % message,
- 'timestamp': order_timestamp,
- 'order_num': order_id
- })
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Messages:%s\tErrors:%s\tWarnings:%s" % (len(status.messages), status.error_count, status.warning_count),
- })
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Finished Checking %s" % filename,
- })
-
- if status.error_count==0:
- print "Integrating %s" % filename
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Importing %s" % filename,
- })
- for order in sale_orders:
- order.store()
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Import Finished",
- })
- if not os.path.isdir(os.path.join(data['form']['ediimportdir'],'archive')):
- os.mkdir(os.path.join(data['form']['ediimportdir'],'archive'))
- os.rename(file, os.path.join(data['form']['ediimportdir'],'archive', filename))
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Moved %s to archive" % filename,
- })
- else:
- ids=pooler.get_pool(cr.dbname).get('res.users').search(cr,1, [('roles_id', 'ilike', 'EDI')])
- for id in ids:
- pooler.get_pool(cr.dbname).get('res.request').create(cr, uid, { 'act_to': id,
- 'name' : "Error while importing %s" % filename,
- 'ref_doc1' : "edi.log,%s" % log_id,
- 'state' : 'active',
- })
- try:
- os.rename(file, os.path.join(data['form']['ediimportdir'],'erreur', filename))
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Moved %s to erreur" % filename,
- })
- except:
- logline.create(cr, uid, { 'log_id': log_id,
- 'logdesc': "Couldn't move %s to erreur" % filename,
- })
- cr.commit()
- return {}
-
-def _do_import(self, cr, uid, data, context):
- pass
-
-class wiz_edi_import(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : { 'type' : 'form', 'arch' : _import_form, 'fields' : _import_fields, 'state' : [('end', 'Cancel'),('check', 'Check EDI')]},
- },
- 'check' : {
- 'actions' : [ _prepare_import ],
-# 'result' : { 'type' : 'print', 'report' : 'edi.import-results', 'state' : [('do_import', 'Import EDI'), ('end', 'End')] },
- 'result' : { 'type' : 'form', 'arch' : _import_done_form, 'fields': _import_done_fields, 'state' : [('end','end')]},
- },
- 'do_import' : {
- 'actions' : [ _do_import ],
- 'result' : { 'type' : 'form', 'arch' : _import_done_form, 'fields' : _import_done_fields, 'state' : [('end','end')]},
- },
- }
-
-class sale_order:
-
- def __init__(self, cr, uid, sr):
- self.cr=cr
- self.uid=uid
- self.shop_id=pooler.get_pool(cr.dbname).get('sale.shop').search(cr, uid, [])[0]
- self.pricelist_id = None
- self.order_lines=[]
- self.partner_id=sr['sender']
- self.partner_order_id=0
- self.partner_invoice_id=0
- self.sr = sr
- self.timesatmp_edi=time.strftime('%Y%m%d%H%M')
- self.ordernum = '0'
- self.deliverdate=None
- self.note = ''
-
- def store(self):
- if not hasattr(self, 'partner_invoice_id'):
- self.partner_invoice_id = self.partner_id
- if not hasattr(self, 'partner_shipping_id'):
- self.partner_shipping_id = self.partner_invoice_id
- order_id = pooler.get_pool(cr.dbname).get('sale.order').create(self.cr, self.uid, { 'partner_id': self.partner_id,
- 'partner_order_id': self.partner_order_id,
- 'partner_invoice_id': self.partner_invoice_id,
- 'partner_shipping_id': self.partner_shipping_id,
- 'shop_id': self.shop_id,
- 'pricelist_id': self.pricelist_id,
- 'client_order_ref': self.ordernum,
- 'date_order': self.orderdate,
- 'note': self.note,
- })
- for orderline in self.order_lines:
- orderline.store(order_id)
-
- def addline(self, line):
- self.orderlines.append(line)
-
- def parse_line(self, line_type, line_content, status):
- if hasattr(self, "_parse_%s" % line_type):
- myFct=getattr(self, "_parse_%s" % line_type)
- myFct(line_content, status)
- else:
- status.add_warning("ignoring line type: %s" % line_type, self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HINT(self, line_content, status):
- self.timestamp_edi="%s%s" % (line_content["date"], line_content["time"])
- self.sr['sender'] = line_content['sender']
-
- partners=pooler.get_pool(cr.dbname).get('res.partner').search(self.cr, self.uid, [('ean13','=',line_content["receiver"]),])
- if len(partners) != 1:
- status.add_error("unknown receiver: %s" % line_content["receiver"], self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- self.sr['receiver']=partners[0]
- thisadd=pooler.get_pool(cr.dbname).get('res.users').read(self.cr, self.uid, [self.uid], ['address_id'])[0]['address_id'][0]
- partner=pooler.get_pool(cr.dbname).get('res.partner.address').read(self.cr, self.uid, [thisadd], ['partner_id'])[0]['partner_id'][0]
- if not partner or partner!=self.sr['receiver']:
- status.add_error("This message is not for us (%s)" % line_content["receiver"], self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HGEN(self, line_content, status):
- if line_content["order-num"]=='':
- status.add_error("No client order reference", self.ordernum, self.timestamp_edi, self.sr['sender'])
- self.ordernum=line_content["order-num"]
- self.orderdate=line_content["order-date"]
- if line_content["message-type"]!="ORDERS93A" and line_content["message-type"]!="ORDERS96A" and line_content["message-type"]!="GENCOD02303" and line_content["message-type"]!="GENCOD08604":
- status.add_error("Unknown message type %s" % line_content["message-type"], self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HDEL(self, line_content, status):
- if (not self.deliverdate or self.deliverdate > line_content['deliv-date']) and line_content['deliv-q'] in ('137', '200'):
- self.deliverdate = line_content['deliv-date']
- if self.deliverdate < self.orderdate:
- status.add_error("%s (order date) is after %s (delivery date)" % (self.orderdate,self.deliverdate), self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HPTY(self, line_content, status):
- partner_table = pooler.get_pool(cr.dbname).get('res.partner')
-
- partners = partner_table.search(self.cr, self.uid, [('ean13', '=', line_content['partner-code'])])
- if partners and len(partners) == 1:
- default_addresses = pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id', '=', partners[0]), ('type', 'ilike', 'default')])
- if not default_addresses:
- default_addresses = pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id', '=', partners[0]), ('type', 'ilike', '')])
- if not default_addresses:
- default_addresses = pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id', '=', partners[0])])
- self.hpty_dispatchers[line_content['partner-type']](self, partners[0], default_addresses, line_content, status)
- else:
- status.add_error("unknown %s: %s" % (line_content["partner-type"], line_content["partner-code"]), self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HPTYBY(self, partner, default_addresses, line_content, status):
- partner_table = pooler.get_pool(cr.dbname).get('res.partner')
-
- self.sr['sender'] = partner
- self.partner_id = partner
- self.partner_order_id = default_addresses[0]
- self.pricelist_id = ir.ir_get(self.cr, self.uid, 'meta', 'product.pricelist', [('res.partner', self.partner_id)])[0][2]
- orders=pooler.get_pool(cr.dbname).get("sale.order").search(self.cr, self.uid, [('client_order_ref', 'ilike', self.ordernum), ('partner_order_id',"=",self.partner_order_id)])
- if orders and len(orders)>0:
- status.add_warning("This client order reference (%s) already exists for this client" % self.ordernum, self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HPTYSU(self, partner, default_addresses, line_content, status):
- partner_table = pooler.get_pool(cr.dbname).get('res.partner')
- if not (partner_table._is_related_to(self.cr, self.uid, [partner], self.sr['receiver'])[0] or self.sr['receiver'] == partner):
- status.add_error("unknown %s: %s" % (line_content["partner-type"], line_content["partner-code"]), self.ordernum, self.timestamp_edi, self.sr['sender'])
-
- def _parse_HPTYDP(self, partner, default_addresses, line_content, status):
- shipping_addresses=pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id','=',partner), ('type', 'ilike', 'delivery')])
- if len(shipping_addresses) < 1:
- self.partner_shipping_id=default_addresses[0]
- else:
- self.partner_shipping_id=shipping_addresses[0]
-
- invoice_addresses=pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id','=',partner), ('type', 'ilike', 'invoice')])
- if len(invoice_addresses) < 1:
- self.partner_invoice_id=default_addresses[0]
- else:
- self.partner_invoice_id=invoice_addresses[0]
-
- def _parse_HPTYIV(self, partner, default_addresses, line_content, status):
- invoice_addresses=pooler.get_pool(cr.dbname).get('res.partner.address').search(self.cr, self.uid, [('partner_id','=',partner), ('type', 'ilike', 'invoice')])
- if len(invoice_addresses) < 1:
- self.partner_invoice_id=default_addresses[0]
- else:
- self.partner_invoice_id=invoice_addresses[0]
-
- hpty_dispatchers = { 'BY' : _parse_HPTYBY, 'SU' : _parse_HPTYSU, 'DP' : _parse_HPTYDP, 'IV' : _parse_HPTYIV }
-
- def _parse_HFTX(self, line_content, status):
- self.note+=line_content['text']+'\n'
-
- def _parse_DART(self, line_content, status):
- products=pooler.get_pool(cr.dbname).get('product.product').search(self.cr, self.uid, [('ean13','=',line_content["barcode"]),])
- #sale_order_line_o=sale_order_line(self.cr, self.uid, self.deliverdate, self.partner_invoice_id, status)
- sale_order_line_o=sale_order_line(self.cr, self.uid, self, self.deliverdate)
- if len(products) != 1:
- status.add_error("unknown product: %s" % line_content["barcode"], self.ordernum, self.timestamp_edi, self.sr['sender'])
- return
- else:
- sale_order_line_o.product=products[0]
- sale_order_line_o.product_ean=line_content["barcode"]
- if (line_content["unit21"]==''):
- status.add_warning("Using default Unit Of Measure", self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- uoms=pooler.get_pool(cr.dbname).get('product.uom').search(self.cr, self.uid, [('name', 'ilike', line_content["unit21"]),])
- if len(uoms) != 1:
- status.add_error("unknown uom: %s" % line_content["unit21"], self.ordernum, self.timestamp_edi, self.sr['sender'])
- return
- else:
- sale_order_line_o.uom=uoms[0]
- sale_order_line_o.quantity=float(line_content["quantity21"])
- sale_order_line_o.uoc_quantity=float(line_content["quantity59"])
- sale_order_line_o.lineid=line_content["line-num"]
- sale_order_line_o.partner_address=None
- sale_order_line_o.price=line_content["price"]
- if sale_order_line_o.partner==0:
- partner=self.partner_id
- else:
- partner=sale_order_line_o.partner
- pricelist_id = ir.ir_get(self.cr, self.uid, 'meta', 'product.pricelist', [('res.partner', partner)])[0][2]
- sale_order_line_o.price = pooler.get_pool(cr.dbname).get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], sale_order_line_o.product, sale_order_line_o.quantity)[pricelist_id]
- sale_order_line_o.pricelist_id=pricelist_id
- if float(line_content["price"])!=sale_order_line_o.price:
- status.add_warning("Price from EDI (%s) different from what we have (%s) for product %s" % (str(float(line_content["price"])), sale_order_line_o.price, line_content["barcode"]), self.ordernum, self.timestamp_edi, self.sr['sender'])
- product_infos = pooler.get_pool(cr.dbname).get('product.product').read(self.cr, self.uid, [sale_order_line_o.product])[0]
- if line_content['price-unit']=="":
- status.add_warning("Blank Unit Of Price for product %s should be %s" % (line_content['barcode'], product_infos['uos_id'][1]), self.ordernum, self.timestamp_edi, self.sr['sender'])
- sale_order_line_o.price_unit= product_infos['uos_id'][0]
- elif product_infos['uos_id'][1] != line_content['price-unit']:
- status.add_error('Invalid Unit Of Price for product %s Should be "%s" instead of "%s"' % (line_content['barcode'], product_infos['uos_id'][1], line_content["price-unit"]), self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- sale_order_line_o.price_unit= product_infos['uos_id'][0]
- sale_order_line_o.price_unit_customer=float(line_content['hint-price'])
- sale_order_line_o.check(status)
- self.order_lines.append(sale_order_line_o)
-
- def _parse_DDEL(self, line_content, status):
- sale_order_line_o = self.order_lines[len(self.order_lines)-1]
- sale_order_line_o.deliv_date = "%s%s" % (line_content["deliv-date"], line_content["deliv-time"])
-
- def _parse_DPTY(self, line_content, status):
- if len(self.order_lines)<1:
- status.add_error("no DART line parsed before this DPTY line", self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- sale_order_line_o = self.order_lines[len(self.order_lines)-1]
- partners=pooler.get_pool(cr.dbname).get('res.partner').search(self.cr, self.uid, [('ean13','=',line_content["shop-barcode"]),])
- if len(partners) != 1:
- status.add_error("unknown address: %s" % line_content["shop-barcode"], self.ordernum, self.timestamp_edi, self.sr['sender'])
- elif not _child_of_partner(self.cr, self.uid, partners[0], self.sr['sender']):
- status.add_error("unknown address: %s" % line_content["shop-barcode"], self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- sale_order_line_o.partner_address=partners[0]
-
- def _parse_DPID(self, line_content, status):
- if len(self.order_lines)<1:
- status.add_error("no DART line parsed before this DPTY line", self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- sale_order_line_o = self.order_lines[len(self.order_lines)-1]
- sale_order_line_o.note+=line_content['ident-art']+'\n'
-
- def _parse_DFTX(self, line_content, status):
- if len(self.order_lines)<1:
- status.add_error("no DART line parsed before this DPTY line", self.ordernum, self.timestamp_edi, self.sr['sender'])
- else:
- sale_order_line_o = self.order_lines[len(self.order_lines)-1]
- sale_order_line_o.note+=line_content['text']+'\n'
-
-
-class sale_order_line:
-
- def __init__(self, cr, uid, sale_order_o, deliv_date):
- #, partner_address, status):
- self.cr=cr
- self.uid=uid
- self.insertdict={}
- self.partner_address=None
- if deliv_date:
- self.deliv_date=deliv_date
- self.note=''
- self.product=0
- self.sale_order= sale_order_o
- self.price_unit=0
- if sale_order_o.partner_invoice_id!=0:
- self.partner=pooler.get_pool(cr.dbname).get('res.partner.address').read(self.cr, self.uid, [sale_order_o.partner_invoice_id], ['partner_id'])[0]['partner_id'][0]
- else:
- self.partner=0
- #self.status=status
-
- def check(self, status):
- self.cr.execute('select id from product_packaging where product_id=%d and qty=%f limit 1', (self.product, float(self.uoc_quantity)))
- packs = self.cr.fetchone()
- if packs is None or not len(packs):
- status.add_error('Invalid package for product %s (%s)' % (self.product_ean, float(self.uoc_quantity)), self.sale_order.ordernum, self.sale_order.timestamp_edi, self.sale_order.sr['sender'])
- else:
- self.pack_id=packs[0]
-
- #print "PriceList: %s, product: %s, quantity: %s " % (self.pricelist_id, self.product, self.quantity)
- try:
- dico=pooler.get_pool(cr.dbname).get('sale.order.line').product_id_change(self.cr, self.uid, [], self.pricelist_id, self.product, int(float(self.quantity)))
- self.insertdict.update({'product_uos_qty': dico['value']['product_uos_qty'], 'product_uos': dico['value']['product_uos'][0], 'price_unit': dico['value']['price_unit']})
- except:
- status.add_error('No price defined for product %s, line ommited !' % (self.product_ean,), self.sale_order.ordernum, self.sale_order.timestamp_edi, self.sale_order.sr['sender'])
- #print str(dico)
- # Checking the unit used for the price computation
-# product_infos = pooler.get_pool(cr.dbname).get('product.product').read(self.cr, self.uid, [self.product])[0]
-# if product_infos['uos_id'][1] != self.price_unit:
-# status.add_warning('Invalid unit for Sale price : Should be "%s"' % product_infos['uos_id'][1], self.sale_order.ordernum, self.sale_order.timestamp_edi, self.sale_order.sr['sender'])
-
- # Checking the price
-
-# if unit_price != self.price:
-# status.add_warning('Invalid price', self.sale_order.ordernum, self.sale_order.timestamp_edi, self.sale_order.sr['sender'])
-
- def store (self, order_id):
- insertdict.update( { 'order_id': order_id,
- 'product_id': self.product,
- 'product_uom_qty': self.quantity,
- 'name': "%s%s" %(order_id, self.lineid),
- 'address_allotment_id': self.partner_address,
- 'notes': self.note,
- 'product_packaging': self.pack_id,
-# 'unit_price': self.price_unit,
- 'price_unit': self.price,
- 'price_unit_customer': self.price_unit_customer,
- })
- self.unit_price=self.price
- if hasattr(self, 'uom'):
- insertdict['product_uom'] = self.uom
- else:
- insertdict['product_uom'], desc = pooler.get_pool(cr.dbname).get('product.product').read(self.cr, self.uid, [self.product], ['uom_id'])[0]['uom_id']
- if hasattr(self, 'deliv_date'):
- insertdict['date_planned'] = self.deliv_date
- id=pooler.get_pool(cr.dbname).get('sale.order.line').create(self.cr, self.uid, insertdict)
- return id
-
-class edi_status:
- def __init__(self):
- self.error_count=0
- self.warning_count=0
- self.messages=[]
-
- def add_error(self, message, order_id, timestamp_edi, sender):
- self.messages.append((order_id, timestamp_edi, sender, "ERROR:\t%s" % message))
- self.error_count+=1
-
- def add_warning(self, message, order_id, timestamp_edi, sender):
- self.messages.append((order_id, timestamp_edi, sender, "WARNING:\t%s" % message))
- self.warning_count+=1
-
-wiz_edi_import('edi.import')
-
-
diff --git a/addons/esale_ez/__init__.py b/addons/esale_ez/__init__.py
deleted file mode 100644
index fcd36a7dba4..00000000000
--- a/addons/esale_ez/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import esale
diff --git a/addons/esale_ez/__terp__.py b/addons/esale_ez/__terp__.py
deleted file mode 100644
index bdef4735729..00000000000
--- a/addons/esale_ez/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "EZ Publish eCommerce Interface",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Interfaces/CMS & eCommerce",
- "website" : "http://tinyerp.com/demo02_6.html",
- "description": "Module to interface with the EZ Publish ecommerce system.",
- "depends" : ["product", "stock", "sale"],
- "init_xml" : [],
- "demo_xml" : ["esale_demo.xml"],
- "update_xml" : ["esale_view.xml"],
- "active": False,
- "installable": False
-}
diff --git a/addons/esale_ez/esale.py b/addons/esale_ez/esale.py
deleted file mode 100644
index dfa931aa61f..00000000000
--- a/addons/esale_ez/esale.py
+++ /dev/null
@@ -1,251 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import netsvc
-from osv import fields,osv,orm
-import ir
-
-import time
-from mx import DateTime
-
-class esale_web(osv.osv):
- _name = "esale.web"
- _description = "eCommerce Website"
- _columns = {
- 'name': fields.char('eShop Name',size=64, required=True),
- 'shop_id': fields.many2one('sale.shop', 'Sale Shop', required=True),
- 'partner_anonymous_id': fields.many2one('res.partner', 'Anonymous', required=True),
- 'active': fields.boolean('Active'),
- 'product_all': fields.boolean('All product'),
- 'product_ids': fields.many2many('product.product', 'esale_web_product_rel', 'web_id', 'product_id', 'Web Products')
- }
- _defaults = {
- 'product_all': lambda *a: 1,
- 'active': lambda *a: 1
- }
- #
- # Compute the stock for one product depending on the POS
- #
- def stock_get(self, cr, uid, shop_id, product_id):
- res = self.pool.get('product.product').read(cr, uid, [product_id], ['qty_available'], {'shop': shop_id})[0]['qty_available']
- return res
-
- #
- # Compute the price for one product
- #
- def price_get(self, cr, uid, product_id, product_qty, partner_id):
- pricelist = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.id
- price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product_id, product_qty)[pricelist]
- return price
-
- #
- # PRE:
- # order = {
- # 'partner_id': 1,
- # 'partner_name:'',
- # 'date':'20051010',
- # 'user_id':1,
- # 'products':[
- # {'product_id':1,
- # 'product_name':'',
- # 'price':19.9,
- # 'product_qty': 1}
- # ]
- #
- # POST:
- # order.extend({'price_subtotal': 0.0,
- # 'price_tax': 0.0,
- # 'price_total': 0.0,
- # 'products': [
- # {'product_id':1,
- # 'product_name':'',
- # 'price':19.9,
- # 'product_qty': 1,
- # 'qty_available': 1,
- # 'date_available': '20051010'}
- # ]})
- #
- def compute(self, cr, uid, ids, order, context={}):
- pricelist = self.pool.get('res.partner').browse(cr, uid, order['partner_id']).property_product_pricelist.id
- subtotal = 0
- taxes = 0
- for product in order['products']:
- product_id = int(product['product_id'])
- price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product_id, int(product['product_qty']))[pricelist]
- product['price'] = price
-
- prod_info = self.pool.get('product.product').read(cr, uid, [product_id], ['sale_delay', 'qty_available', 'code', 'name'])[0]
- dt = (DateTime.now() + DateTime.RelativeDateTime(days=prod_info['sale_delay'] or 0.0)).strftime('%Y-%m-%d')
- product['date_available'] = dt
- product['qty_available'] = prod_info['qty_available']
- product['code'] = prod_info['code']
- product['name'] = prod_info['name']
- product['subtotal'] = price * int(product['product_qty'])
- subtotal += (price * int(product['product_qty']))
- taxes += 0
- order['price_subtotal'] = subtotal
- order['price_tax'] = taxes
- order['price_total'] = taxes + subtotal
- return order
-esale_web()
-
-#
-# Not yet Used !
-# For futur development, used to stock web user preferences
-#
-class esale_user(osv.osv):
- _name = "esale.user"
- _description = "eCommerce User"
- _columns = {
- 'name': fields.char('User Name',size=64, required=True),
- 'partner_id':fields.many2one('res.partner','Partner',required=True),
- 'picking_policy': fields.selection([
- ('direct','Direct Delivery'),
- ('one','All at once')
- ], 'Packing Policy', required=True ),
- 'order_policy': fields.selection([
- ('prepaid','Pay before delivery'),
- ('manual','Shipping & Manual Invoice'),
- ('postpaid','Invoice after delivery'),
- ], 'Shipping Policy', required=True),
- 'web_ref':fields.char('Web Reference', size=16, required=True),
- 'web_id': fields.many2one('esale.web', 'Web Shop', required=True),
- }
- _defaults = {
- 'order_policy': lambda *a: 'prepaid',
- 'picking_policy': lambda *a: 'one'
- }
-esale_user()
-
-class esale_order(osv.osv):
- _name='esale.order'
- _columns = {
- 'name': fields.char('Order Description',size=64, required=True),
- 'state': fields.selection([
- ('draft','Draft'),
- ('done','Done'),
- ('cancel','Cancel')
- ], 'Order State'),
- 'date_order':fields.date('Date Ordered', required=True),
- 'partner_id':fields.many2one('res.partner', 'Partner', required=True),
- 'web_id':fields.many2one('esale.web', 'Web Shop', required=True),
- 'web_ref':fields.integer('Web Ref'),
- 'order_lines': fields.one2many('esale.order.line', 'order_id', 'Order Lines'),
- 'order_id': fields.many2one('sale.order', 'Sale Order'),
- 'note': fields.text('Notes'),
- }
- _defaults = {
- 'date_order': lambda *a: time.strftime('%Y-%m-%d'),
- 'state': lambda *a: 'draft',
- }
-
- def order_create(self, cr, uid, ids, context={}):
- for order in self.browse(cr, uid, ids, context):
- addr = self.pool.get('res.partner').address_get(cr, uid, [order.partner_id.id], ['delivery','invoice','contact'])
- pricelist_id=order.partner_id.property_product_pricelist.id
- order_lines = []
- for line in order.order_lines:
- order_lines.append( (0,0,{
- 'name': line.name,
- 'product_qty': line.product_qty,
- 'date_planned': line.date_planned,
- 'product_id': line.product_id.id,
- 'product_uom': line.product_uom.id,
- 'price_unit': line.price_unit,
- 'type': line.product_id.procure_method
- }) )
- order_id = self.pool.get('sale.order').create(cr, uid, {
- 'name': order.name,
- 'shop_id': order.web_id.shop_id.id,
- 'origin': 'WEB:'+str(order.id),
- 'date_order': order.date_order,
- 'user_id': uid,
- 'partner_id': order.partner_id.id,
- 'partner_invoice_id':addr['invoice'],
- 'partner_order_id':addr['contact'],
- 'partner_shipping_id':addr['delivery'],
- 'pricelist_id': pricelist_id,
- 'order_line': order_lines
- })
- self.write(cr, uid, [order.id], {'state':'done', 'order_id': order_id})
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'sale.order', order_id, 'order_confirm', cr)
- return True
-
- def order_cancel(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'cancel'})
- return True
-
- def order_upload(self, cr, uid, web_id, orders):
- for order in orders:
- lines = []
- for prod in order['order_lines']:
- prod['product_uom'] = self.pool.get('product.product').browse(cr, uid, [prod['product_id']])[0].uom_id.id
- lines.append( (0,0, prod) )
- self.create(cr, uid, {
- 'name': str(order['ref'])+': '+order['partner_name'],
- 'partner_id': int(order['partner_id']),
- 'web_id': int(web_id),
- 'web_ref': int(order['ref']),
- 'note': order['notes'],
- 'order_lines': lines
- })
- return True
-
- def state_get(self, cr, uid, refs):
- result = {}
- for r in refs:
- result[str(r)] = False
- ids = self.search(cr, uid, [('web_ref','in',map(int,refs))])
- for order in self.browse(cr, uid, ids):
- if order.order_id:
- result[str(order.web_ref)] = order.order_id.state
- else:
- result[str(order.web_ref)] = 'draft'
- return result
-esale_order()
-
-class esale_order_line(osv.osv):
- _name = 'esale.order.line'
- _description = 'eSale Order line'
- _columns = {
- 'name': fields.char('Order Line', size=64, required=True),
- 'order_id': fields.many2one('esale.order', 'eOrder Ref'),
- 'product_qty': fields.float('Quantity', digits=(16,2), required=True),
- 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], change_default=True),
- 'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),
- 'price_unit': fields.float('Unit Price', required=True),
- 'date_planned': fields.date('Scheduled date', required=True),
- }
- _defaults = {
- 'date_planned': lambda *a: time.strftime('%Y-%m-%d'),
- }
-esale_order_line()
-
-
diff --git a/addons/esale_ez/esale_data.xml b/addons/esale_ez/esale_data.xml
deleted file mode 100644
index 8a7a21bc522..00000000000
--- a/addons/esale_ez/esale_data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="ir.ui.view" id="vtree">
- <field name="name">esale.web.tree</field>
- <field name="model">esale.web</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSale Web Shop">
- <field name="name" select="1"/>
- <field name="partner_anonymous_id"/>
- <field name="shop_id" select="1"/>
- </tree>
- </field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/esale_ez/esale_demo.xml b/addons/esale_ez/esale_demo.xml
deleted file mode 100644
index 9e5d7a7f672..00000000000
--- a/addons/esale_ez/esale_demo.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data noupdate="1">
- <record model="esale.web" id="esale_web_shop1">
- <field name="name">eCommerce Shop</field>
- <field name="shop_id" model="sale.shop" search="[]"/>
- <field name="partner_anonymous_id" model="res.partner" search="[]"/>
- </record>
- </data>
-</terp>
diff --git a/addons/esale_ez/esale_view.xml b/addons/esale_ez/esale_view.xml
deleted file mode 100644
index a304c5a82ef..00000000000
--- a/addons/esale_ez/esale_view.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="ir.ui.view" id="vtree">
- <field name="name">esale.web.tree</field>
- <field name="model">esale.web</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSale Web Shop">
- <field name="name" select="1"/>
- <field name="partner_anonymous_id"/>
- <field name="shop_id" select="1"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_web_form">
- <field name="name">esale.web.form</field>
- <field name="model">esale.web</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale Web Shop">
- <field name="name" select="1"/>
- <field name="active" select="1"/>
- <field name="shop_id" select="1"/>
- <field name="product_all"/>
- <field name="partner_anonymous_id" colspan="4"/>
- <field name="product_ids" colspan="4"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_shop_tree">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale.shop</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Esales/Configuration/Ecommerce Website" id="menu_action_shop_tree" action="action_shop_tree" groups="admin"/>
-
-
- <record model="ir.ui.view" id="view_order_tree">
- <field name="name">esale.order.tree</field>
- <field name="model">esale.order</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Sales Orders">
- <field name="name"/>
- <field name="date_order"/>
- <field name="partner_id"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_order_form">
- <field name="name">esale.order.form</field>
- <field name="model">esale.order</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale Order">
- <notebook>
- <page string="Order Line">
- <field name="name" select="1" colspan="4"/>
- <field name="partner_id" select="1"/>
- <field name="date_order" select="1"/>
- <field name="web_id" select="1"/>
- <field name="web_ref" select="1"/>
- <field name="order_lines" widget="one2many_list" colspan="4" nolabel="1"/>
- <separator string="States" colspan="4"/>
- <field name="state"/>
- <button type="object" name="order_create" states="draft" string="Create Order"/>
- <button type="object" name="order_cancel" states="draft" string="Cancel Order"/>
- </page>
- <page string="Others data">
- <field name="order_id" colspan="4"/>
- <field name="note" colspan="4"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_order_form">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale.order</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_order_form"/>
- </record>
- <menuitem name="Esales/Esales Order" id="menu_action_order_form" action="action_order_form" groups="admin"/>
-
- <record model="ir.actions.act_window" id="action_order_tree">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale.order</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','draft')]</field>
- </record>
- <menuitem name="Esales/Esales Order/Draft Esales Order" id="menu_action_order_tree" action="action_order_tree" groups="admin"/>
-
-
- <record model="ir.ui.view" id="view_order_line_form">
- <field name="name">esale.order.line.form</field>
- <field name="model">esale.order.line</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSales Order Line">
- <field name="name" colspan="4"/>
- <field name="product_id" colspan="4"/>
- <field name="product_qty"/>
- <field name="product_uom"/>
-
- <field name="price_unit"/>
- <field name="date_planned"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_order_line_tree">
- <field name="name">esale.order.line.tree</field>
- <field name="model">esale.order.line</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSales Order Line">
- <field name="name"/>
- <field name="product_id"/>
- <field name="product_qty"/>
- <field name="product_uom"/>
- <field name="price_unit"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_user_tree">
- <field name="name">esale.user.tree</field>
- <field name="model">esale.user</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSale user">
- <field name="name"/>
- <field name="partner_id"/>
- <field name="web_id"/>
- <field name="web_ref"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_user_form">
- <field name="name">esale.user.form</field>
- <field name="model">esale.user</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale user">
- <field name="name" select="1" colspan="4"/>
- <field name="partner_id" select="1" colspan="4"/>
- <field name="web_id"/>
- <field name="web_ref"/>
- <field name="picking_policy"/>
- <field name="order_policy"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_user_form">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale.user</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_user_form"/>
- </record>
-
-</data>
-</terp>
diff --git a/addons/esale_joomla/__init__.py b/addons/esale_joomla/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/esale_joomla/__init__.py
+++ /dev/null
diff --git a/addons/esale_joomla/__terp__.py b/addons/esale_joomla/__terp__.py
deleted file mode 100644
index ceb97aa6f8d..00000000000
--- a/addons/esale_joomla/__terp__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "eSale Interface - Joomla",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Interfaces/CMS & eCommerce",
- "website" : "http://tinyerp.com",
- "depends" : ["product", "stock", "sale", "account", "account_tax_include",],
- "description": """Joomla (Virtuemart) eCommerce interface synchronisation.
-Users can order on the website, orders are automatically imported in Tiny
-ERP.
-
-You can export products, stock level and create links between
-categories of products, taxes and languages.
-
-If you product has an image attched, it send the image to the Joomla website.""",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ['esale_joomla_wizard.xml', "esale_joomla_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/esale_joomla/connector/tinyerp-synchro.php b/addons/esale_joomla/connector/tinyerp-synchro.php
deleted file mode 100644
index b88b2ed460c..00000000000
--- a/addons/esale_joomla/connector/tinyerp-synchro.php
+++ /dev/null
@@ -1,327 +0,0 @@
-<?php
-
- define( '_VALID_MOS', 1);
-
- include("xmlrpc.inc");
- include("xmlrpcs.inc");
-
- require_once( 'configuration.php' );
- require_once( 'includes/joomla.php' );
- require_once( 'administrator/components/com_virtuemart/virtuemart.cfg.php' );
-
- $con = mysql_pconnect($mosConfig_host, $mosConfig_user,$mosConfig_password );
- mysql_select_db($mosConfig_db);
-
- function get_taxes() {
- global $mosConfig_dbprefix;
- $taxes=array();
-
- $result=mysql_query("select tax_rate_id, tax_rate*100 from ".$mosConfig_dbprefix."vm_tax_rate;");
- if ($result) while ($row=mysql_fetch_row($result)) {
- $taxes[]=new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval("Tax ".$row[1]."%", "string")), "array");
- }
- return new xmlrpcresp( new xmlrpcval($taxes, "array"));
- }
-
- function get_languages() {
- $languages=array();
-
- $languages[]=new xmlrpcval(array(new xmlrpcval(1, "int"), new xmlrpcval("Unique", "string")), "array");
- return new xmlrpcresp( new xmlrpcval($languages, "array"));
- }
-
- function get_categories() {
- global $mosConfig_dbprefix;
- $categories=array();
-
- $result=mysql_query("select category_id, category_name from ".$mosConfig_dbprefix."vm_category;");
- if ($result) while ($row=mysql_fetch_row($result)) {
- $categories[]=new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval(parent_category($row[0],$row[1]), "string")), "array");
- }
- return new xmlrpcresp( new xmlrpcval($categories, "array"));
- }
-
- function parent_category($id, $name) {
- global $mosConfig_dbprefix;
- $result=mysql_query("select category_parent_id from ".$mosConfig_dbprefix."vm_category_xref where category_child_id=".$id.";");
- if ($result && $row=mysql_fetch_row($result)) {
- if ($row[0]==0) {
- return $name;
- } else {
- $resultb=mysql_query("select category_name from ".$mosConfig_dbprefix."vm_category where category_id=".$row[0].";");
- if ($resultb && $rowb=mysql_fetch_row($resultb)) {
- $name=parent_category($row[0], $rowb[0] . " \\ ". $name);
- return $name;
- }
- }
- }
- return $name;
- }
-
- function set_product_stock($tiny_product) {
- global $mosConfig_dbprefix;
- mysql_query("update ".$mosConfig_dbprefix."vm_product set product_in_stock=".$tiny_product['quantity']." where
- product_id=".$tiny_product['esale_joomla_id'].";");
- //mysql_query("update products set products_status=".(($tiny_product['quantity']>0)?1:0)." where
- //products_id=".$tiny_product['esale_joomla_id'].";");
- return new xmlrpcresp(new xmlrpcval(1,"int"));
- }
-
-
- function set_product_category($category_id, $product_ids) {
-
- global $mosConfig_dbprefix;
-
- foreach($product_ids as $key => $value){
- $result = mysql_query("select count(*) from ".$mosConfig_dbprefix."vm_product_category_xref where category_id=".$category_id." and product_id=".$value.";");
- $row = mysql_fetch_row($result);
- if (! $row[0] ){
- mysql_query("insert into ".$mosConfig_dbprefix."vm_product_category_xref values (".$category_id.", ".$value.", NULL);");
- }
- }
- return new xmlrpcresp(new xmlrpcval(1,"int"));
-
- }
-
- function unpublish_product($product_ids){
- global $mosConfig_dbprefix;
- mysql_query("update ".$mosConfig_dbprefix."vm_product set product_publish='N' where product_id in (".implode(",",$product_ids).");");
- return new xmlrpcresp(new xmlrpcval(1,"int"));
- }
-
- function debug($s) {
- $fp = fopen("/tmp/debug.xmlrpc.txt","a");
- fwrite($fp, $s."\n");
- fclose($fp);
- }
-
-
- function set_product($tiny_product){
- global $mosConfig_dbprefix;
- $prod = Array(
- 'vendor_id'=>0
- );
-
- $result=mysql_query("select vendor_id, vendor_currency from ".$mosConfig_dbprefix."vm_vendor;");
- if ($result && $row=mysql_fetch_row($result)) {
- $prod['vendor_id']=$row[0];
- $prod['vendor_currency']=$row[1];
- }
- $result=mysql_query("select shopper_group_id from ".$mosConfig_dbprefix."vm_shopper_group where vendor_id=".$prod['vendor_id']." and shopper_group_name='-default-';");
- if ($result && $row=mysql_fetch_row($result))
- $prod['shopper_group']=$row[0];
- if ( $tiny_product['esale_joomla_id']) {
- $result = mysql_query("select count(*) from ".$mosConfig_dbprefix."vm_product where product_id=". $tiny_product['esale_joomla_id']);
- $row = mysql_fetch_row($result);
- if (! $row[0] )
- $tiny_product['esale_joomla_id'] = 0;
- }
-
- if (! $tiny_product['esale_joomla_id']) {
- mysql_query("insert into ".$mosConfig_dbprefix."vm_product () values ()");
- $osc_id=mysql_insert_id();
- mysql_query("insert into ".$mosConfig_dbprefix."vm_product_price (product_id, product_price, product_currency, product_price_vdate, product_price_edate, shopper_group_id) values (".$osc_id.", ".$tiny_product['price'].", '".$prod['vendor_currency']."', 0, 0, ".$prod['shopper_group'].");");
- mysql_query("insert into ".$mosConfig_dbprefix."vm_product_category_xref (product_id, category_id) values (".$osc_id.", ".$tiny_product['category_id'].");");
- } else {
- $osc_id=$tiny_product['esale_joomla_id'];
- }
-
- mysql_query("update ".$mosConfig_dbprefix."vm_product set ".
- "product_in_stock=".$tiny_product['quantity'].",".
- "product_weight=".$tiny_product['weight'].",".
- "product_tax_id=".$tiny_product['tax_class_id'].",".
- "product_sku='".mysql_escape_string($tiny_product['model'])."',".
- "product_name='".mysql_escape_string($tiny_product['name'])."',".
- "vendor_id='".$prod['vendor_id']."',".
- "product_desc='".mysql_escape_string($tiny_product['description'])."', ".
- "product_publish='Y',".
- "product_s_desc='".mysql_escape_string(substr($tiny_product['description'],0,200))."' ".
- "where product_id=".$osc_id.";");
-
- // Replace or
- // Delete old values
-
- mysql_query("update ".$mosConfig_dbprefix."vm_product_price set product_price='".$tiny_product['price']."' where product_id=".$osc_id.";");
- mysql_query("update ".$mosConfig_dbprefix."vm_product_category set category_id='".$tiny_product['category_id']."' where product_id=".$osc_id.";");
-
- if ($tiny_product['haspic']==1) {
- $filename=tempnam('components/com_virtuemart/shop_image/product/', 'tiny_');
- $extension=strrchr($tiny_product['fname'],'.');
- $filename.=$extension;
- //file_put_contents($filename, base64_decode($tiny_product['picture']));
- $hd=fopen($filename, "w");
- fwrite($hd, base64_decode($tiny_product['picture']));
- fclose($hd);
- $short=strrchr($filename,'/');
- $short=substr($short, 1, strlen($short));
- mysql_query("update ".$mosConfig_dbprefix."vm_product set product_full_image='".$short."' where product_id=".$osc_id.";");
- $newxsize = PSHOP_IMG_WIDTH;
- if (!$newxsize) {
- $newxsize=90;
- }
- $newysize = PSHOP_IMG_HEIGHT;
- if (!$newysize) {
- $newysize=60;
- }
- $extension=strtolower($extension);
- if (in_array($extension, array('.jpeg', '.jpe', '.jpg', '.gif', '.png'))) {
- if (in_array($extension, array('.jpeg', '.jpe', '.jpg'))) {
- $extension='.jpeg';
- }
- $thumb=tempnam('components/com_virtuemart/shop_image/product/', 'tiny_').$extension;
- $load='imagecreatefrom'.substr($extension,1,strlen($extension)-1);
- $save='image'.substr($extension,1,strlen($extension)-1);
- $tmp_img=$load($filename);
- $imgsize = getimagesize($filename);
- if ($imgsize[0] > $newxsize || $imgsize[1] > $newysize) {
- if ($imgsize[0]*$newysize > $imgsize[1]*$newxsize) {
- $ratio=$imgsize[0]/$newxsize;
- } else {
- $ratio=$imgsize[1]/$newysize;
- }
- } else {
- $ratio=1;
- }
- $tn=imagecreatetruecolor (floor($imgsize[0]/$ratio),floor($imgsize[1]/$ratio));
- imagecopyresized($tn,$tmp_img,0,0,0,0,floor($imgsize[0]/$ratio),floor($imgsize[1]/$ratio),$imgsize[0],$imgsize[1]);
- $short=strrchr($thumb,'/');
- $short=substr($short,1,strlen($short));
- $save($tn, $thumb);
- mysql_query("update ".$mosConfig_dbprefix."vm_product set product_thumb_image='".$short."' where product_id=".$osc_id.";");
- }
- }
- return new xmlrpcresp(new xmlrpcval($osc_id, "int"));
- }
-
- function get_saleorders($last_so) {
- global $mosConfig_dbprefix;
- $saleorders=array();
-
- $result=mysql_query(
- "SELECT
- o.`order_id`, c.`last_name`, c.`address_1`, c.`city`, c.`zip`, c.`state`,
- c.`country`, c.`phone_1`, c.`user_email`, d.`last_name` , d.`address_1` ,
- d.`city`, d.`zip`, d.`state`, d.`country`, o.`cdate`,
- c.title, c.first_name, d.title, d.first_name,
- d.user_id, c.user_id, o.customer_note
- FROM ".
- $mosConfig_dbprefix."vm_orders as o,".
- $mosConfig_dbprefix."vm_user_info as c, ".
- $mosConfig_dbprefix."vm_user_info as d
- where
- o.order_id>".$last_so." and
- o.user_id=c.user_id and
- (c.address_type_name is NULL or c.address_type_name='-default-') and
- o.user_info_id=d.user_info_id;
- ");
-
- if ($result) while ($row=mysql_fetch_row($result)) {
- $orderlines=array();
- $resultb=mysql_query("select product_id, product_quantity, product_item_price from ".$mosConfig_dbprefix."vm_order_item where order_id=".$row[0].";");
- if ($resultb) while ($rowb=mysql_fetch_row($resultb)) {
- $orderlines[]=new xmlrpcval( array(
- "product_id" => new xmlrpcval($rowb[0], "int"),
- "product_qty" => new xmlrpcval($rowb[1], "int"),
- "price" => new xmlrpcval($rowb[2], "int")
- ), "struct");
- }
- $saleorders[] = new xmlrpcval( array(
- "id" => new xmlrpcval( $row[0], "int"),
- "note" => new xmlrpcval( $row[22], "string"),
- "lines" => new xmlrpcval( $orderlines, "array"),
- "address" => new xmlrpcval( array(
- "name" => new xmlrpcval($row[16]." ".$row[1]." ".$row[17], "string"),
- "address" => new xmlrpcval($row[2], "string"),
- "city" => new xmlrpcval($row[3], "string"),
- "zip" => new xmlrpcval($row[4], "string"),
- "state" => new xmlrpcval($row[5], "string"),
- "country" => new xmlrpcval($row[6], "string"),
- "phone" => new xmlrpcval($row[7], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[20], "string")
- ), "struct"),
- "delivery" => new xmlrpcval( array(
- "name" => new xmlrpcval($row[18]." ".$row[9]." ".$row[19], "string"),
- "address" => new xmlrpcval($row[10], "string"),
- "city" => new xmlrpcval($row[11], "string"),
- "zip" => new xmlrpcval($row[12], "string"),
- "state" => new xmlrpcval($row[13], "string"),
- "country" => new xmlrpcval($row[14], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[21], "string")
- ), "struct"),
- "billing" =>new xmlrpcval( array(
- "name" => new xmlrpcval($row[16]." ".$row[1]." ".$row[17], "string"),
- "address" => new xmlrpcval($row[2], "string"),
- "city" => new xmlrpcval($row[3], "string"),
- "zip" => new xmlrpcval($row[4], "string"),
- "state" => new xmlrpcval($row[5], "string"),
- "country" => new xmlrpcval($row[6], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[20], "string")
- ), "struct"),
- "date" => new xmlrpcval( date('YmdHis',$row[15]), "date")
- ), "struct");
- }
- return new xmlrpcresp(new xmlrpcval($saleorders, "array"));
- }
-
- function process_order($order_id) {
- global $mosConfig_dbprefix;
- mysql_query("update ".$mosConfig_dbprefix."vm_orders set order_status='C' where order_id=".$order_id.";");
- mysql_query("update ".$mosConfig_dbprefix."vm_order_item set oerder_status='C' where order_id=".$order_id.";");
- return new xmlrpcresp(new xmlrpcval(0, "int"));
- }
-
- function close_order($order_id) {
- global $mosConfig_dbprefix;
- mysql_query("update ".$mosConfig_dbprefix."vm_orders set order_status='S' where order_id=".$order_id.";");
- mysql_query("update ".$mosConfig_dbprefix."vm_order_item set oerder_status='S' where order_id=".$order_id.";");
- return new xmlrpcresp(new xmlrpcval(0, "int"));
- }
-
- $server = new xmlrpc_server( array(
- "get_taxes" => array(
- "function" => "get_taxes",
- "signature" => array(array($xmlrpcArray))
- ),
- "get_languages" => array(
- "function" => "get_languages",
- "signature" => array(array($xmlrpcArray))
- ),
- "get_categories" => array(
- "function" => "get_categories",
- "signature" => array(array($xmlrpcArray))
- ),
- "get_saleorders" => array(
- "function" => "get_saleorders",
- "signature" => array(array($xmlrpcArray, $xmlrpcInt))
- ),
- "set_product_category" => array(
- "function" => "set_product_category",
- "signature" => array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcArray))
- ),
- "unpublish_product" => array(
- "function" => "unpublish_product",
- "signature" => array(array($xmlrpcInt, $xmlrpcArray))
- ),
- "set_product" => array(
- "function" => "set_product",
- "signature" => array(array($xmlrpcInt, $xmlrpcStruct))
- ),
- "set_product_stock" => array(
- "function" => "set_product_stock",
- "signature" => array(array($xmlrpcInt, $xmlrpcStruct))
- ),
- "process_order" => array(
- "function" => "process_order",
- "signature" => array(array($xmlrpcInt, $xmlrpcInt))
- ),
- "close_order" => array(
- "function" => "close_order",
- "signature" => array(array($xmlrpcInt, $xmlrpcInt))
- )
- ), false);
- $server->functions_parameters_type= 'phpvals';
- $server->service();
-?>
diff --git a/addons/esale_joomla/connector/xmlrpc.inc b/addons/esale_joomla/connector/xmlrpc.inc
deleted file mode 100644
index d0043dc4eb1..00000000000
--- a/addons/esale_joomla/connector/xmlrpc.inc
+++ /dev/null
@@ -1,3600 +0,0 @@
-<?php // -*-c++-*-
-// by Edd Dumbill (C) 1999-2002
-// <edd@usefulinc.com>
-// $Id: xmlrpc.inc,v 1.113 2006/01/22 23:55:57 ggiunta Exp $
-
-
-// Copyright (c) 1999,2000,2002 Edd Dumbill.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// * Neither the name of the "XML-RPC for PHP" nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
- if(!function_exists('xml_parser_create'))
- {
- // For PHP 4 onward, XML functionality is always compiled-in on windows:
- // no more need to dl-open it. It might have been compiled out on *nix...
- if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
- {
- dl('xml.so');
- }
- }
-
- // Try to be backward compat with php < 4.2 (are we not being nice ?)
- if(substr(phpversion(), 0, 3) == '4.0' || @version_compare(substr(phpversion(), 0, 3) == '4.1'))
- {
- // give an opportunity to user to specify where to include other files from
- if(!defined('PHP_XMLRPC_COMPAT_DIR'))
- {
- define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');
- }
- if(substr(phpversion(), 0, 3) == '4.0')
- {
- include(PHP_XMLRPC_COMPAT_DIR."is_scalar.php");
- include(PHP_XMLRPC_COMPAT_DIR."array_key_exists.php");
- include(PHP_XMLRPC_COMPAT_DIR."version_compare.php");
- }
- include(PHP_XMLRPC_COMPAT_DIR."var_export.php");
- include(PHP_XMLRPC_COMPAT_DIR."is_a.php");
- }
-
- // G. Giunta 2005/01/29: declare global these variables,
- // so that xmlrpc.inc will work even if included from within a function
- // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
- $GLOBALS['xmlrpcI4']='i4';
- $GLOBALS['xmlrpcInt']='int';
- $GLOBALS['xmlrpcBoolean']='boolean';
- $GLOBALS['xmlrpcDouble']='double';
- $GLOBALS['xmlrpcString']='string';
- $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
- $GLOBALS['xmlrpcBase64']='base64';
- $GLOBALS['xmlrpcArray']='array';
- $GLOBALS['xmlrpcStruct']='struct';
- $GLOBALS['xmlrpcValue']='undefined';
-
- $GLOBALS['xmlrpcTypes']=array(
- $GLOBALS['xmlrpcI4'] => 1,
- $GLOBALS['xmlrpcInt'] => 1,
- $GLOBALS['xmlrpcBoolean'] => 1,
- $GLOBALS['xmlrpcString'] => 1,
- $GLOBALS['xmlrpcDouble'] => 1,
- $GLOBALS['xmlrpcDateTime'] => 1,
- $GLOBALS['xmlrpcBase64'] => 1,
- $GLOBALS['xmlrpcArray'] => 2,
- $GLOBALS['xmlrpcStruct'] => 3
- );
-
- $GLOBALS['xmlrpc_valid_parents'] = array(
- 'BOOLEAN' => array('VALUE'),
- 'I4' => array('VALUE'),
- 'INT' => array('VALUE'),
- 'STRING' => array('VALUE'),
- 'DOUBLE' => array('VALUE'),
- 'DATETIME.ISO8601' => array('VALUE'),
- 'BASE64' => array('VALUE'),
- 'ARRAY' => array('VALUE'),
- 'STRUCT' => array('VALUE'),
- 'PARAM' => array('PARAMS'),
- 'METHODNAME' => array('METHODCALL'),
- 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
- 'MEMBER' => array('STRUCT'),
- 'NAME' => array('MEMBER'),
- 'DATA' => array('ARRAY'),
- 'FAULT' => array('METHODRESPONSE'),
- 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
- );
-
- $GLOBALS['xmlEntities']=array(
- 'amp' => '&',
- 'quot' => '"',
- 'lt' => '<',
- 'gt' => '>',
- 'apos' => "'"
- );
-
- // tables used for transcoding different charsets into us-ascii xml
-
- $GLOBALS['xml_iso88591_Entities']=array();
- $GLOBALS['xml_iso88591_Entities']['in'] = array();
- $GLOBALS['xml_iso88591_Entities']['out'] = array();
- for ($i = 0; $i < 32; $i++)
- {
-
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
- $GLOBALS['xml_iso88591_Entities']['out'][] = "&#$i;";
- }
- for ($i = 160; $i < 256; $i++)
- {
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
- $GLOBALS['xml_iso88591_Entities']['out'][] = "&#$i;";
- }
-
- /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159.
- /// These will NOT be present in true ISO-8859-1, but will save the unwary
- /// windows user from sending junk.
-/*
-$cp1252_to_htmlent =
- array(
- '\x80'=>'&#x20AC;', '\x81'=>'?', '\x82'=>'&#x201A;', '\x83'=>'&#x0192;',
- '\x84'=>'&#x201E;', '\x85'=>'&#x2026;', '\x86'=>'&#x2020;', \x87'=>'&#x2021;',
- '\x88'=>'&#x02C6;', '\x89'=>'&#x2030;', '\x8A'=>'&#x0160;', '\x8B'=>'&#x2039;',
- '\x8C'=>'&#x0152;', '\x8D'=>'?', '\x8E'=>'&#x017D;', '\x8F'=>'?',
- '\x90'=>'?', '\x91'=>'&#x2018;', '\x92'=>'&#x2019;', '\x93'=>'&#x201C;',
- '\x94'=>'&#x201D;', '\x95'=>'&#x2022;', '\x96'=>'&#x2013;', '\x97'=>'&#x2014;',
- '\x98'=>'&#x02DC;', '\x99'=>'&#x2122;', '\x9A'=>'&#x0161;', '\x9B'=>'&#x203A;',
- '\x9C'=>'&#x0153;', '\x9D'=>'?', '\x9E'=>'&#x017E;', '\x9F'=>'&#x0178;'
- );
-*/
-
- $GLOBALS['xmlrpcerr']['unknown_method']=1;
- $GLOBALS['xmlrpcstr']['unknown_method']='Unknown method';
- $GLOBALS['xmlrpcerr']['invalid_return']=2;
- $GLOBALS['xmlrpcstr']['invalid_return']='Invalid return payload: enable debugging to examine incoming payload';
- $GLOBALS['xmlrpcerr']['incorrect_params']=3;
- $GLOBALS['xmlrpcstr']['incorrect_params']='Incorrect parameters passed to method';
- $GLOBALS['xmlrpcerr']['introspect_unknown']=4;
- $GLOBALS['xmlrpcstr']['introspect_unknown']="Can't introspect: method unknown";
- $GLOBALS['xmlrpcerr']['http_error']=5;
- $GLOBALS['xmlrpcstr']['http_error']="Didn't receive 200 OK from remote server.";
- $GLOBALS['xmlrpcerr']['no_data']=6;
- $GLOBALS['xmlrpcstr']['no_data']='No data received from server.';
- $GLOBALS['xmlrpcerr']['no_ssl']=7;
- $GLOBALS['xmlrpcstr']['no_ssl']='No SSL support compiled in.';
- $GLOBALS['xmlrpcerr']['curl_fail']=8;
- $GLOBALS['xmlrpcstr']['curl_fail']='CURL error';
- $GLOBALS['xmlrpcerr']['invalid_request']=15;
- $GLOBALS['xmlrpcstr']['invalid_request']='Invalid request payload';
- $GLOBALS['xmlrpcerr']['no_curl']=16;
- $GLOBALS['xmlrpcstr']['no_curl']='No CURL support compiled in.';
- $GLOBALS['xmlrpcerr']['server_error']=17;
- $GLOBALS['xmlrpcstr']['server_error']='Internal server error';
- $GLOBALS['xmlrpcerr']['multicall_error']=18;
- $GLOBALS['xmlrpcstr']['multicall_error']='Received from server invalid multicall response';
-
- $GLOBALS['xmlrpcerr']['multicall_notstruct'] = 9;
- $GLOBALS['xmlrpcstr']['multicall_notstruct'] = 'system.multicall expected struct';
- $GLOBALS['xmlrpcerr']['multicall_nomethod'] = 10;
- $GLOBALS['xmlrpcstr']['multicall_nomethod'] = 'missing methodName';
- $GLOBALS['xmlrpcerr']['multicall_notstring'] = 11;
- $GLOBALS['xmlrpcstr']['multicall_notstring'] = 'methodName is not a string';
- $GLOBALS['xmlrpcerr']['multicall_recursion'] = 12;
- $GLOBALS['xmlrpcstr']['multicall_recursion'] = 'recursive system.multicall forbidden';
- $GLOBALS['xmlrpcerr']['multicall_noparams'] = 13;
- $GLOBALS['xmlrpcstr']['multicall_noparams'] = 'missing params';
- $GLOBALS['xmlrpcerr']['multicall_notarray'] = 14;
- $GLOBALS['xmlrpcstr']['multicall_notarray'] = 'params is not an array';
-
- $GLOBALS['xmlrpcerr']['cannot_decompress']=103;
- $GLOBALS['xmlrpcstr']['cannot_decompress']='Received from server compressed HTTP and cannot decompress';
- $GLOBALS['xmlrpcerr']['decompress_fail']=104;
- $GLOBALS['xmlrpcstr']['decompress_fail']='Received from server invalid compressed HTTP';
- $GLOBALS['xmlrpcerr']['dechunk_fail']=105;
- $GLOBALS['xmlrpcstr']['dechunk_fail']='Received from server invalid chunked HTTP';
- $GLOBALS['xmlrpcerr']['server_cannot_decompress']=106;
- $GLOBALS['xmlrpcstr']['server_cannot_decompress']='Received from client compressed HTTP request and cannot decompress';
- $GLOBALS['xmlrpcerr']['server_decompress_fail']=107;
- $GLOBALS['xmlrpcstr']['server_decompress_fail']='Received from client invalid compressed HTTP request';
-
- // The charset encoding used by the server for received messages and
- // by the client for received responses when received charset cannot be determined
- // or is not supported
- $GLOBALS['xmlrpc_defencoding']='UTF-8';
- // The encoding used internally by PHP.
- // String values received as xml will be converted to this, and php strings will be converted to xml
-
- // as if having been coded with this
- $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
-
- $GLOBALS['xmlrpcName']='XML-RPC for PHP';
- $GLOBALS['xmlrpcVersion']='2.0RC3';
-
- // let user errors start at 800
- $GLOBALS['xmlrpcerruser']=800;
- // let XML parse errors start at 100
- $GLOBALS['xmlrpcerrxml']=100;
-
- // formulate backslashes for escaping regexp
- $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
-
- // used to store state during parsing
- // quick explanation of components:
- // ac - used to accumulate values
- // isf - used to indicate a fault
- // lv - used to indicate "looking for a value": implements
- // the logic to allow values with no types to be strings
- // params - used to store parameters in method calls
- // method - used to store method name
- // stack - array with genealogy of xml elements names:
- // used to validate nesting of xmlrpc elements
-
- $GLOBALS['_xh']=null;
-
- /**
- * Convert a string to the correct XML representation in a target charset
- * To help correct communication of non-ascii chars inside strings, regardless
- * of the charset used when sending requests, parsing them, sending responses
- * and parsing responses, an option is to convert all non-ascii chars present in the message
- * into their equivalent 'charset entity'. Charset entities enumerated this way
- * are independent of the charset encoding used to transmit them, and all XML
- * parsers are bound to understand them.
- * Note that in the std case we are not sending a charset encoding mime type
- * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
- *
- * @todo do a bit of basic benchmarking (strtr vs. str_replace)
- * @todo make usage of iconv() or recode_string() or mb_string() where available
- */
- function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
- {
- if ($src_encoding == '')
- {
- // lame, but we know no better...
- $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
- }
- //if ($dest_encoding == '')
- //{
- // // lame, but we know no better...
- // $dest_encoding = 'US-ASCII';
- //}
- switch(strtoupper($src_encoding.'_'.$dest_encoding))
- {
- case 'ISO-8859-1_':
- case 'ISO-8859-1_US-ASCII':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
- break;
- case 'ISO-8859-1_UTF-8':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- $escaped_data = utf8_encode($escaped_data);
- break;
- case 'ISO-8859-1_ISO-8859-1':
- case 'US-ASCII_US-ASCII':
- case 'US-ASCII_UTF-8':
- case 'US-ASCII_':
- case 'US-ASCII_ISO-8859-1':
- case 'UTF-8_UTF-8':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- break;
- case 'UTF-8_':
- case 'UTF-8_US-ASCII':
- case 'UTF-8_ISO-8859-1':
- // NB: this will choke on invalid UTF-8, going most likely beyond EOF
- $escaped_data = "";
- // be kind to users creating string xmlrpcvals out of different php types
- $data = (string) $data;
- $ns = strlen ($data);
- for ($nn = 0; $nn < $ns; $nn++)
- {
- $ch = $data[$nn];
- $ii = ord($ch);
-//1 7 0bbbbbbb (127)
- if ($ii < 128)
- {
- /// @todo shall we replace this with a (suuposedly) faster str_replace?
- switch($ii){
- case 34:
- $escaped_data .= '&quot;';
- break;
- case 38:
- $escaped_data .= '&amp;';
- case 39:
- $escaped_data .= '&apos;';
- break;
- case 60:
- $escaped_data .= '&lt;';
- break;
- case 62:
- $escaped_data .= '&gt;';
- break;
- default:
- $escaped_data .= $ch;
- } // switch
- }
-//2 11 110bbbbb 10bbbbbb (2047)
- else if ($ii>>5 == 6)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ($b1 * 64) + $b2;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
-//3 16 1110bbbb 10bbbbbb 10bbbbbb
- else if ($ii>>4 == 14)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ord($data[$nn+2]);
- $b3 = ($ii & 63);
- $ii = ((($b1 * 64) + $b2) * 64) + $b3;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
-//4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- else if ($ii>>3 == 30)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ord($data[$nn+2]);
- $b3 = ($ii & 63);
- $ii = ord($data[$nn+3]);
- $b4 = ($ii & 63);
- $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
- }
- break;
- default:
- $escaped_data = '';
- error_log("Converting from $src_encoding to $dest_encoding: not supported...");
- }
-// } // switch
- return $escaped_data;
- }
-
- function xmlrpc_se($parser, $name, $attrs)
- {
- // if invalid xmlrpc already detected, skip all processing
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- // check for correct element nesting
- // top level element can only be of 2 types
- if (count($GLOBALS['_xh']['stack']) == 0)
- {
- if ($name != 'METHODRESPONSE' && $name != 'METHODCALL')
- {
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
- return;
- }
- }
- else
- {
- // not top level element: see if parent is OK
- $parent = end($GLOBALS['_xh']['stack']);
- if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
- {
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
- return;
- }
- }
-
- switch($name)
- {
- case 'STRUCT':
- case 'ARRAY':
- // create an empty array to hold child values, and push it onto appropriate stack
- $cur_val = array();
- $cur_val['values'] = array();
- $cur_val['type'] = $name;
- // check for out-of-band information to rebuild php objs
- // and in case it is found, save it
- if (@isset($attrs['PHP_CLASS']))
- {
- $cur_val['php_class'] = $attrs['PHP_CLASS'];
- }
- $GLOBALS['_xh']['valuestack'][] = $cur_val;
- break;
- case 'DATA':
- case 'METHODCALL':
- case 'METHODRESPONSE':
- case 'PARAMS':
- // valid elements that add little to processing
- break;
- case 'METHODNAME':
- case 'NAME':
- $GLOBALS['_xh']['ac']='';
- break;
- case 'FAULT':
- $GLOBALS['_xh']['isf']=1;
- break;
- case 'VALUE':
- $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
- $GLOBALS['_xh']['ac']='';
- $GLOBALS['_xh']['lv']=1;
- $GLOBALS['_xh']['php_class']=null;
- break;
- case 'I4':
- case 'INT':
- case 'STRING':
- case 'BOOLEAN':
- case 'DOUBLE':
- case 'DATETIME.ISO8601':
- case 'BASE64':
- if ($GLOBALS['_xh']['vt']!='value')
- {
- //two data elements inside a value: an error occurred!
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
- return;
- }
-
- $GLOBALS['_xh']['ac']=''; // reset the accumulator
- break;
- case 'MEMBER':
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
- //$GLOBALS['_xh']['ac']='';
- // Drop trough intentionally
- case 'PARAM':
- // clear value type, so we can check later if no value has been passed for this param/member
- $GLOBALS['_xh']['vt']=null;
- break;
- default:
- /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";
- break;
- }
-
- // Save current element name to stack, to validate nesting
- $GLOBALS['_xh']['stack'][] = $name;
-
- if($name!='VALUE')
- {
- $GLOBALS['_xh']['lv']=0;
- }
- }
- }
-
- function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
- {
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- // push this element name from stack
- // NB: if XML validates, correct opening/closing is guaranteed and
- // we do not have to check for $name == $curr_elem.
- // we also checked for proper nesting at start of elements...
- $curr_elem = array_pop($GLOBALS['_xh']['stack']);
-
- switch($name)
- {
- case 'STRUCT':
- case 'ARRAY':
- // fetch out of stack array of values, and promote it to current value
- $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
- $GLOBALS['_xh']['value'] = $curr_val['values'];
- $GLOBALS['_xh']['vt']=strtolower($name);
- if (isset($curr_val['php_class']))
- {
- $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
- }
- break;
- case 'NAME':
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
- break;
- case 'BOOLEAN':
- case 'I4':
- case 'INT':
- case 'STRING':
- case 'DOUBLE':
- case 'DATETIME.ISO8601':
- case 'BASE64':
- $GLOBALS['_xh']['vt']=strtolower($name);
- if ($name=='STRING')
- {
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- }
- elseif ($name=='DATETIME.ISO8601')
- {
- /// @todo validate datetime values with a correct format mask?
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- }
- elseif ($name=='BASE64')
- {
- /// @todo check for failure of base64 decoding / catch warnings
- $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
- }
- elseif ($name=='BOOLEAN')
- {
- // special case here: we translate boolean 1 or 0 into PHP
- // constants true or false
- // NB: this simple checks helps a lot sanitizing input, ie no
- // security problems around here
- if ($GLOBALS['_xh']['ac']=='1')
- {
- $GLOBALS['_xh']['value']=true;
- }
- else
- {
- // log if receiveing something strange, even though we set the value to false anyway
- if ($GLOBALS['_xh']['ac']!='0')
- error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']=false;
- }
- }
- elseif ($name=='DOUBLE')
- {
- // we have a DOUBLE
- // we must check that only 0123456789-.<space> are characters here
- if (!ereg("^[+-]?[eE0123456789 \\t.]+$", $GLOBALS['_xh']['ac']))
- {
- /// @todo: find a better way of throwing an error
- // than this!
- error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
- }
- else
- {
- // it's ok, add it on
- $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
- }
- }
- else
- {
- // we have an I4/INT
- // we must check that only 0123456789-<space> are characters here
- if (!ereg("^[+-]?[0123456789 \\t]+$", $GLOBALS['_xh']['ac']))
- {
- /// @todo find a better way of throwing an error
- // than this!
- error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
- }
- else
- {
- // it's ok, add it on
- $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
- }
- }
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- $GLOBALS['_xh']['lv']=3; // indicate we've found a value
- break;
- case 'VALUE':
- // This if() detects if no scalar was inside <VALUE></VALUE>
- if ($GLOBALS['_xh']['vt']=='value')
- {
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
- }
-
- if ($rebuild_xmlrpcvals)
- {
- // build the xmlrpc val out of the data received, and substitute it
- $temp =& new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
- // in case we got info about underlying php class, save it
- // in the object we're rebuilding
- if (isset($GLOBALS['_xh']['php_class']))
- $temp->_php_class = $GLOBALS['_xh']['php_class'];
- // check if we are inside an array or struct:
- // if value just built is inside an array, let's move it into array on the stack
- $vscount = count($GLOBALS['_xh']['valuestack']);
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
- {
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
- }
- else
- {
- $GLOBALS['_xh']['value'] = $temp;
- }
- }
- else
- {
- /// @todo this needs to treat correctly php-serialized objects,
- /// since std deserializing is done by php_xmlrpc_decode,
- /// which we will not be calling...
- if (isset($GLOBALS['_xh']['php_class']))
- {
- }
-
- // check if we are inside an array or struct:
- // if value just built is inside an array, let's move it into array on the stack
- $vscount = count($GLOBALS['_xh']['valuestack']);
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
- {
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
- }
- }
- break;
- case 'MEMBER':
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- // add to array in the stack the last element built,
- // unless no VALUE was found
- if ($GLOBALS['_xh']['vt'])
- {
- $vscount = count($GLOBALS['_xh']['valuestack']);
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
- } else
- error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
- break;
- case 'DATA':
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- break;
- case 'PARAM':
- // add to array of params the current value,
- // unless no VALUE was found
- if ($GLOBALS['_xh']['vt'])
- {
- $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
- $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
- }
- else
- error_log('XML-RPC: missing VALUE inside PARAM in received xml');
- break;
- case 'METHODNAME':
- $GLOBALS['_xh']['method']=ereg_replace("^[\n\r\t ]+", '', $GLOBALS['_xh']['ac']);
- break;
- case 'PARAMS':
- case 'FAULT':
- case 'METHODCALL':
- case 'METHORESPONSE':
- break;
- default:
- // End of INVALID ELEMENT!
- // shall we add an assert here for unreachable code???
- break;
- }
- }
- }
-
- function xmlrpc_ee_fast($parser, $name)
- {
- xmlrpc_ee($parser, $name, false);
- }
-
- function xmlrpc_cd($parser, $data)
- {
- //if(ereg("^[\n\r \t]+$", $data)) return;
- // print "adding [${data}]\n";
-
- // skip processing if xml fault already detected
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- if($GLOBALS['_xh']['lv']!=3)
- {
- // "lookforvalue==3" means that we've found an entire value
- // and should discard any further character data
- if($GLOBALS['_xh']['lv']==1)
- {
- // if we've found text and we're just in a <value> then
- // say we've found a value
- $GLOBALS['_xh']['lv']=2;
- }
- if(!@isset($GLOBALS['_xh']['ac']))
- {
- $GLOBALS['_xh']['ac'] = '';
- }
- $GLOBALS['_xh']['ac'].=$data;
- }
- }
- }
-
- function xmlrpc_dh($parser, $data)
- {
- // skip processing if xml fault already detected
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
- {
- if($GLOBALS['_xh']['lv']==1)
- {
- $GLOBALS['_xh']['lv']=2;
- }
- $GLOBALS['_xh']['ac'].=$data;
- }
- }
- }
-
- class xmlrpc_client
- {
- var $path;
- var $server;
- var $port=0;
- var $method='http';
- var $errno;
- var $errstr;
- var $debug=0;
- var $username='';
- var $password='';
- var $cert='';
- var $certpass='';
- var $key='';
- var $keypass='';
- var $verifypeer=1;
- var $verifyhost=1;
- var $no_multicall=false;
- var $proxy = '';
- var $proxyport=0;
- var $proxy_user = '';
- var $proxy_pass = '';
- var $cookies=array();
- /**
- * List of http compression methods accepted by the client for responses.
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
- *
- * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
- * in those cases it will be up to CURL to decide the compression methods
- * it supports. You might check for the presence of 'zlib' in the output of
- * curl_version() to determine wheter compression is supported or not
- */
- var $accepted_compression = array();
- /**
- * Name of compression scheme to be used for sending requests.
- * Either null, gzip or deflate
- */
- var $request_compression = '';
- /**
- * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
- * http://curl.haxx.se/docs/faq.html#7.3)
- */
- var $xmlrpc_curl_handle = null;
- /// Wheter to use persistent connections for http 1.1 and https
- var $keepalive = false;
- /// Charset encodings that can be decoded without problems by the client
- var $accepted_charset_encodings = array();
- /// Charset encoding to be used in serializing request. NULL = use ASCII
- var $request_charset_encoding = '';
- /**
- * Decides the content of xmlrpcresp objects returned by calls to send()
- * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
- */
- var $return_type = 'xmlrpcvals';
-
- /**
- * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
- * @param string $server the server name / ip address
- * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
- * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
- */
- function xmlrpc_client($path, $server='', $port='', $method='')
- {
- // allow user to specify all params in $path
- if($server == '' and $port == '' and $method == '')
- {
- $parts = parse_url($path);
- $server = $parts['host'];
- $path = $parts['path'];
- if(isset($parts['query']))
- {
- $path .= '?'.$parts['query'];
- }
- if(isset($parts['fragment']))
- {
- $path .= '#'.$parts['fragment'];
- }
- if(isset($parts['port']))
- {
- $port = $parts['port'];
- }
- if(isset($parts['scheme']))
- {
- $method = $parts['scheme'];
- }
- if(isset($parts['user']))
- {
- $this->username = $parts['user'];
- }
- if(isset($parts['pass']))
- {
- $this->password = $parts['pass'];
- }
- }
- if($path == '' || $path[0] != '/')
- {
- $this->path='/'.$path;
- }
- else
- {
- $this->path=$path;
- }
- $this->server=$server;
- if($port != '')
- {
- $this->port=$port;
- }
- if($method != '')
- {
- $this->method=$method;
- }
-
- // if ZLIB is enabled, let the client by default accept compressed responses
- if(function_exists('gzinflate') || (
- function_exists('curl_init') && (($info = curl_version()) &&
- ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
- ))
- {
- $this->accepted_compression = array('gzip', 'deflate');
- }
-
- // keepalives: enabled by default ONLY for PHP >= 4.3.8
- // (see http://curl.haxx.se/docs/faq.html#7.3)
- if(version_compare(phpversion(), '4.3.8') >= 0)
- {
- $this->keepalive = true;
- }
-
- // by default the xml parser can support these 3 charset encodings
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
- }
-
- /*
- * Enables/disables the echoing to screen of the xmlrpc responses received
- * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, beside received response)
- * @access public
- */
- function setDebug($in)
- {
- $this->debug=$in;
- }
-
- /*
- * Add some http BASIC AUTH credentials, used by the client to authenticate
- * @param string $u username
- * @param string $p password
- * @access public
- */
- function setCredentials($u, $p)
- {
- $this->username=$u;
- $this->password=$p;
- }
-
- /*
- * Add a client-side https certificate
- * @param string $cert
- * @param string $certpass
- * @access public
- */
- function setCertificate($cert, $certpass)
- {
- $this->cert = $cert;
- $this->certpass = $certpass;
- }
-
- /*
- * @param string $key The name of a file containing a private SSL key
- * @param string $keypass The secret password needed to use the private SSL key
- * @access public
- * NB: does not work in older php/curl installs
- * Thanks to Daniel Convissor
- */
- function setKey($key, $keypass)
- {
- $this->key = $key;
- $this->keypass = $keypass;
- }
-
- /*
- * @access public
- */
- function setSSLVerifyPeer($i)
- {
- $this->verifypeer = $i;
- }
-
- /*
- * @access public
- */
- function setSSLVerifyHost($i)
- {
- $this->verifyhost = $i;
- }
-
- /**
- * Set proxy info
- *
- * @param string $proxyhost
- * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
- * @param string $proxyusername Leave blank if proxy has public access
- * @param string $proxypassword Leave blank if proxy has public access
- * @access public
- */
- function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '')
- {
- $this->proxy = $proxyhost;
- $this->proxyport = $proxyport;
- $this->proxy_user = $proxyusername;
- $this->proxy_pass = $proxypassword;
- }
-
- /**
- * Enables/disables reception of compressed xmlrpc responses.
- * Note that enabling reception of compressed responses merely adds some standard
- * http headers to xmlrpc requests. It is up to the xmlrpc server to return
- * compressed responses when receiving such requests.
- * @param string $compmethod either 'gzip', 'deflate', 'any' or ''
- * @access public
- */
- function setAcceptedCompression($compmethod)
- {
- if ($compmethod == 'any')
- $this->accepted_compression = array('gzip', 'deflate');
- else
- $this->accepted_compression = array($compmethod);
- }
-
- /**
- * Enables/disables http compression of xmlrpc request.
- * Take care when sending compressed requests: servers might not support them
- * (and automatic fallback to uncompressed requests is not yet implemented)
- * @param string $compmethod either 'gzip', 'deflate' or ''
- * @access public
- */
- function setRequestCompression($compmethod)
- {
- $this->request_compression = $compmethod;
- }
-
- /**
- * Adds a cookie to list of cookies that will be sent to server.
- * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:
- * do not do it unless you know what you are doing
- * @param string $name
- * @param string $value
- * @param string $path
- * @param string $domain
- * @param string $port
- * @access public
- *
- * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
- */
- function setCookie($name, $value='', $path='', $domain='', $port=null)
- {
- $this->cookies[$name]['value'] = urlencode($value);
- if ($path || $domain || $port)
- {
- $this->cookies[$name]['path'] = $path;
- $this->cookies[$name]['domain'] = $domain;
- $this->cookies[$name]['port'] = $port;
- $this->cookies[$name]['version'] = 1;
- }
- else
- {
- $this->cookies[$name]['version'] = 0;
- }
- }
-
- /**
- * Send an xmlrpc request
- * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request
- * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply
- * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used
- */
- function& send($msg, $timeout=0, $method='')
- {
- // if user deos not specify http protocol, use native method of this client
- // (i.e. method set during call to constructor)
- if($method == '')
- {
- $method = $this->method;
- }
-
- if(is_array($msg))
- {
- // $msg is an array of xmlrpcmsg's
- $r = $this->multicall($msg, $timeout, $method);
- return $r;
- }
- elseif(is_string($msg))
- {
- $n =& new xmlrpcmsg('');
- $n->payload = $msg;
- $msg = $n;
- }
-
- // where msg is an xmlrpcmsg
- $msg->debug=$this->debug;
-
- if($method == 'https')
- {
- $r =& $this->sendPayloadHTTPS(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- $this->cert,
- $this->certpass,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass,
- $this->keepalive,
- $this->key,
- $this->keypass
- );
- }
- elseif($method == 'http11')
- {
- $r =& $this->sendPayloadCURL(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- null,
- null,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass,
- 'http',
- $this->keepalive
- );
- }
- else
- {
- $r =& $this->sendPayloadHTTP10(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass
- );
- }
-
- return $r;
- }
-
- /**
- * @access private
- */
- function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,$username='', $password='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='')
- {
- if($port==0)
- {
- $port=80;
- }
-
- // Only create the payload if it was not created previously
- if(empty($msg->payload))
- {
- $msg->createPayload($this->request_charset_encoding);
- }
-
- $payload = $msg->payload;
- // Deflate request body and set appropriate request headers
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
- {
- if($this->request_compression == 'gzip')
- {
- $a = @gzencode($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: gzip\r\n";
- }
- }
- else
- {
- $a = @gzdeflate($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: deflate\r\n";
- }
- }
- }
- else
- {
- $encoding_hdr = '';
- }
-
- // thanks to Grant Rauscher <grant7@firstworld.net>
- // for this
- $credentials='';
- if($username!='')
- {
- $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
- }
-
- $accepted_encoding = '';
- if(is_array($this->accepted_compression) && count($this->accepted_compression))
- {
- $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
- }
-
- $proxy_credentials = '';
- if($proxyhost)
- {
- if($proxyport == 0)
- {
- $proxyport = 8080;
- }
- $connectserver = $proxyhost;
- $connectport = $proxyport;
- $uri = 'http://'.$server.':'.$port.$this->path;
- if($proxyusername != '')
- {
- $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
- }
- }
- else
- {
- $connectserver = $server;
- $connectport = $port;
- $uri = $this->path;
- }
-
- // Cookie generation, as per rfc2965 (version 1 cookies) or
- // netscape's rules (version 0 cookies)
- $cookieheader='';
- foreach ($this->cookies as $name => $cookie)
- {
- if ($cookie['version'])
- {
- $cookieheader .= 'Cookie: $Version="' . $cookie['version'] . '"; ';
- $cookieheader .= $name . '="' . $cookie['value'] . '";';
- if ($cookie['path'])
- $cookieheader .= ' $Path="' . $cookie['path'] . '";';
- if ($cookie['domain'])
- $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
- if ($cookie['port'])
- $cookieheader .= ' $Port="' . $cookie['domain'] . '";';
- $cookieheader = substr($cookieheader, 0, -1) . "\r\n";
- }
- else
- {
- $cookieheader .= 'Cookie: ' . $name . '=' . $cookie['value'] . "\r\n";
- }
- }
-
- $op= "POST " . $uri. " HTTP/1.0\r\n" .
- "User-Agent: " . $GLOBALS['xmlrpcName'] . " " . $GLOBALS['xmlrpcVersion'] . "\r\n" .
- "Host: ". $server . "\r\n" .
- $credentials .
- $proxy_credentials .
- $accepted_encoding .
- $encoding_hdr .
- "Accept-Charset: " . implode(',', $this->accepted_charset_encodings) . "\r\n" .
- $cookieheader .
- "Content-Type: " . $msg->content_type . "\r\nContent-Length: " .
- strlen($payload) . "\r\n\r\n" .
- $payload;
-
-
- if($this->debug > 1)
- {
- print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
- // let the client see this now in case http times out...
- flush();
- }
-
- if($timeout>0)
- {
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
- }
- else
- {
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
- }
- if($fp)
- {
- if($timeout>0 && function_exists('stream_set_timeout'))
- {
- stream_set_timeout($fp, $timeout);
- }
- }
- else
- {
- $this->errstr='Connect error: '.$this->errstr;
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
- return $r;
- }
-
- if(!fputs($fp, $op, strlen($op)))
- {
- $this->errstr='Write error';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
- return $r;
- }
- else
- {
- // reset errno and errstr on succesful socket connection
- $this->errstr = '';
- }
- // G. Giunta 2005/10/24: close socket before parsing.
- // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
- //$resp=&$msg->parseResponseFile($fp);
- $ipd='';
- while($data=fread($fp, 32768))
- {
- // shall we check for $data === FALSE?
- // as per the manual, it signals an error
- $ipd.=$data;
- }
- fclose($fp);
- $r =& $msg->parseResponse($ipd, false, $this->return_type);
- return $r;
-
- }
-
- /**
- * @access private
- */
- function &sendPayloadHTTPS($msg, $server, $port, $timeout=0,$username='', $password='', $cert='',$certpass='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $keepalive=false, $key='', $keypass='')
- {
- $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username, $password, $cert, $certpass,
- $proxyhost, $proxyport, $proxyusername, $proxypassword, 'https', $keepalive, $key, $keypass);
- return $r;
- }
-
- /**
- * Contributed by Justin Miller <justin@voxel.net>
- * Requires curl to be built into PHP
- * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
- * @access private
- */
- function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', $password='', $cert='', $certpass='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $method='https', $keepalive=false,
- $key='', $keypass='')
- {
- if(!function_exists('curl_init'))
- {
- $this->errstr='CURL unavailable on this install';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
- return $r;
- }
- if($method == 'https')
- {
- if(($info = curl_version()) &&
- ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
- {
- $this->errstr='SSL unavailable on this install';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
- return $r;
- }
- }
-
- if($port == 0)
- {
- if($method == 'http')
- {
- $port = 80;
- }
- else
- {
- $port = 443;
- }
- }
-
- // Only create the payload if it was not created previously
- if(empty($msg->payload))
- {
- $msg->createPayload($this->request_charset_encoding);
- }
-
- // Deflate request body and set appropriate request headers
- $payload = $msg->payload;
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
- {
- if($this->request_compression == 'gzip')
- {
- $a = @gzencode($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: gzip";
- }
- }
- else
- {
- $a = @gzdeflate($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: deflate";
- }
- }
- }
- else
- {
- $encoding_hdr = '';
- }
-
- if($this->debug > 1)
- {
- print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
- // let the client see this now in case http times out...
- flush();
- }
-
- if(!$keepalive || !$this->xmlrpc_curl_handle)
- {
- $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
- if($keepalive)
- {
- $this->xmlrpc_curl_handle = $curl;
- }
- }
- else
- {
- $curl = $this->xmlrpc_curl_handle;
- }
-
- // results into variable
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
-
- if($this->debug)
- {
- curl_setopt($curl, CURLOPT_VERBOSE, 1);
- }
- curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);
- // required for XMLRPC: post the data
- curl_setopt($curl, CURLOPT_POST, 1);
- // the data
- curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
-
- // return the header too
- curl_setopt($curl, CURLOPT_HEADER, 1);
-
- // will only work with PHP >= 5.0
- // NB: if we set an empty string, CURL will add http header indicating
- // ALL methods it is supporting. This is possibly a better option than
- // letting the user tell what curl can / cannot do...
- if(is_array($this->accepted_compression) && count($this->accepted_compression))
- {
- //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
- // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- curl_setopt($curl, CURLOPT_ENCODING, '');
- }
- // extra headers
- $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
- // if no keepalive is wanted, let the server know it in advance
- if(!$keepalive)
- {
- $headers[] = 'Connection: close';
- }
- // request compression header
- if($encoding_hdr)
- {
- $headers[] = $encoding_hdr;
- }
-
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- // timeout is borked
- if($timeout)
- {
- curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
- }
-
- if($username && $password)
- {
- curl_setopt($curl, CURLOPT_USERPWD,"$username:$password");
- }
-
- if($method == 'https')
- {
- // set cert file
- if($cert)
- {
- curl_setopt($curl, CURLOPT_SSLCERT, $cert);
- }
- // set cert password
- if($certpass)
- {
- curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
- }
- // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- if($key)
- {
- curl_setopt($curl, CURLOPT_SSLKEY, $key);
- }
- // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- if($keypass)
- {
- curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
- }
- // whether to verify remote host's cert
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
- // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
- }
-
- // proxy info
- if($proxyhost)
- {
- if($proxyport == 0)
- {
- $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
- }
- curl_setopt($curl, CURLOPT_PROXY,$proxyhost.':'.$proxyport);
- //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
- if($proxyusername)
- {
- curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
- }
- }
-
- // NB: should we build cookie http headers by hand rather than let CURL do it?
- // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
- // set to clint obj the the user...
- if (count($this->cookies))
- {
- $cookieheader = '';
- foreach ($this->cookies as $name => $cookie)
- {
- $cookieheader .= $name . '=' . $cookie['value'] . ', ';
- }
- curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
- }
-
- $result = curl_exec($curl);
-
- if(!$result)
- {
- $this->errstr='no response';
- $resp=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
- if(!$keepalive)
- {
- curl_close($curl);
- }
- }
- else
- {
- if(!$keepalive)
- {
- curl_close($curl);
- }
- $resp =& $msg->parseResponse($result, true, $this->return_type);
- }
- return $resp;
- }
-
- /**
- * Send an array of request messages and return an array of responses.
- * Unless $this->no_multicall has been set to true, it will try first
- * to use one single xmlrpc call to server method system.multicall, and
- * revert to sending many successive calls in case of failure.
- * This failure is also stored in $this->no_multicall for subsequent calls.
- * Unfortunately, there is no server error code universally used to denote
- * the fact that multicall is unsupported, so there is no way to reliably
- * distinguish between that and a temporary failure.
- * If you are sure that server supports multicall and do not want to
- * fallback to using many single calls, set the fourth parameter to FALSE.
- *
- * NB: trying to shoehorn extra functionality into existing syntax has resulted
- * in pretty much convoluted code...
- *
- * @access public
- * @param array $msgs an array of xmlrpcmsg objects
- * @param integer $timeout connection timeout (in seconds)
- * @param string $method the http protocol variant to be used
- * @param boolen fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
- */
- function multicall($msgs, $timeout=0, $method='http', $fallback=true)
- {
- if(!$this->no_multicall)
- {
- $results = $this->_try_multicall($msgs, $timeout, $method);
- if(is_array($results))
- {
- // System.multicall succeeded
- return $results;
- }
- else
- {
- // either system.multicall is unsupported by server,
- // or call failed for some other reason.
- if ($fallback)
- {
- // Don't try it next time...
- $this->no_multicall = true;
- }
- else
- {
- if (is_a($result, 'xmlrpcresp'))
- {
- $result = $results;
- }
- else
- {
- $result =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
- }
- }
- }
- }
- else
- {
- // override fallback, in case careless user tries to do two
- // opposite things at the same time
- $fallback = true;
- }
-
- $results = array();
- if ($fallback)
- {
- // system.multicall is (probably) unsupported by server:
- // emulate multicall via multiple requests
- foreach($msgs as $msg)
- {
- $results[] =& $this->send($msg, $timeout, $method);
- }
- }
- else
- {
- // user does NOT want to fallback on many single calls:
- // since we should always return an array of responses,
- // return an array with the same error repeated n times
- foreach($msgs as $msg)
- {
- $results[] = $result;
- }
- }
- return $results;
- }
-
- /**
- * Attempt to boxcar $msgs via system.multicall.
- * Returns either an array of xmlrpcreponses, an xmlrpc error response
- * or false (when recived response does not respect valid multiccall syntax)
- * @access private
- */
- function _try_multicall($msgs, $timeout, $method)
- {
- // Construct multicall message
- $calls = array();
- foreach($msgs as $msg)
- {
- $call['methodName'] =& new xmlrpcval($msg->method(),'string');
- $numParams = $msg->getNumParams();
- $params = array();
- for($i = 0; $i < $numParams; $i++)
- {
- $params[$i] = $msg->getParam($i);
- }
- $call['params'] =& new xmlrpcval($params, 'array');
- $calls[] =& new xmlrpcval($call, 'struct');
- }
- $multicall =& new xmlrpcmsg('system.multicall');
- $multicall->addParam(new xmlrpcval($calls, 'array'));
-
- // Attempt RPC call
- $result =& $this->send($multicall, $timeout, $method);
- //if(!is_object($result))
- //{
- // return ($result || 0); // transport failed
- //}
-
- if($result->faultCode() != 0)
- {
- // call to system.multicall failed
- return $result;
- }
-
- // Unpack responses.
- $rets = $result->value();
-
- if ($this->return_type == 'xml')
- {
- return $rets;
- }
- else if ($this->return_type == 'phpvals')
- {
- ///@todo test this code branch...
- $rets = $result->value();
- if(!is_array($rets))
- {
- return false; // bad return type from system.multicall
- }
- $numRets = count($rets);
- if($numRets != count($msgs))
- {
- return false; // wrong number of return values.
- }
-
- $response = array();
- for($i = 0; $i < $numRets; $i++)
- {
- $val = $rets[$i];
- if (!is_array($val)) {
- return false;
- }
- switch(count($val))
- {
- case 1:
- if(!isset($val[0]))
- {
- return false; // Bad value
- }
- // Normal return value
- $response[$i] =& new xmlrpcresp($val[0], 0, '', 'phpvals');
- break;
- case 2:
- /// @todo remove usage of @: it is apparently quite slow
- $code = @$val['faultCode'];
- if(!is_int($code))
- {
- return false;
- }
- $str = @$val['faultString'];
- if(!is_string($str))
- {
- return false;
- }
- $response[$i] =& new xmlrpcresp(0, $code, $str);
- break;
- default:
- return false;
- }
- }
- return $response;
- }
- else // return type == 'xmlrpcvals'
- {
- $rets = $result->value();
- if($rets->kindOf() != 'array')
- {
- return false; // bad return type from system.multicall
- }
- $numRets = $rets->arraysize();
- if($numRets != count($msgs))
- {
- return false; // wrong number of return values.
- }
-
- $response = array();
- for($i = 0; $i < $numRets; $i++)
- {
- $val = $rets->arraymem($i);
- switch($val->kindOf())
- {
- case 'array':
- if($val->arraysize() != 1)
- {
- return false; // Bad value
- }
- // Normal return value
- $response[$i] =& new xmlrpcresp($val->arraymem(0));
- break;
- case 'struct':
- $code = $val->structmem('faultCode');
- if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
- {
- return false;
- }
- $str = $val->structmem('faultString');
- if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
- {
- return false;
- }
- $response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
- break;
- default:
- return false;
- }
- }
- return $response;
- }
- }
- } // end class xmlrpc_client
-
- class xmlrpcresp
- {
- var $val = 0;
- var $valtyp;
- var $errno = 0;
- var $errstr = '';
- var $hdrs = array();
- var $_cookies = array();
- var $content_type = 'text/xml';
-
- /**
- * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
- * @param integer $fcode set it to anything but 0 to create an error response
- * @param string $fstr the error string, in case of an error response
- * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
- *
- * @todo add check that $val is of correct type???
- * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
- * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
- */
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
- {
- if($fcode != 0)
- {
- // error response
- $this->errno = $fcode;
- $this->errstr = $fstr;
- //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
- }
- /*elseif(!is_object($val) || !is_a($val, 'xmlrpcval'))
- {
- // programmer error
- error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to xmlrpcresp. Defaulting to empty value.");
- $this->val =& new xmlrpcval();
- }*/
- else
- {
- // successful response
- $this->val = $val;
- if ($valtyp == '')
- {
- // user did not declare type of response value: try to guess it
- if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
- {
- $this->valtyp = 'xmlrpcvals';
- }
- else if (is_string($this->val))
- {
- $this->valtyp = 'xml';
-
- }
- else
- {
- $this->valtyp = 'phpvals';
- }
- }
- else
- {
- // user declares type of resp value: believe him
- $this->valtyp = $valtyp;
- }
- }
- }
-
- /*
- * @return integer the error code of this response (0 for not-error responses)
- */
- function faultCode()
- {
- return $this->errno;
- }
-
- /*
- * @return string the error string of this response ('' for not-error responses)
- */
- function faultString()
- {
- return $this->errstr;
- }
-
- /*
- * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects
- */
- function value()
- {
- return $this->val;
- }
-
- /**
- * Returns an array with the cookies received from the server.
- * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
- * with attributes being e.g. 'expires', 'path', domain'.
- * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
- * are still present in the array. It is up to the user-defined code to decide
- * how to use the received cookies, and wheter they have to be sent back with the next
- * request to the server (using xmlrpc_client::setCookie) or not
- * @return array array of cookies received from the server
- * @access public
- */
- function cookies()
- {
- return $this->_cookies;
- }
-
- /**
- * Return xml representation of the response
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
- * @return string the xml representation of the response
- */
- function serialize($charset_encoding='')
- {
- if ($charset_encoding != '')
- $this->content_type = 'text/xml; charset=' . $charset_encoding;
- else
- $this->content_type = 'text/xml';
- $result = "<methodResponse>\n";
- if($this->errno)
- {
- // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
- // by xml-encoding non ascii chars
- $result .= "<fault>\n" .
-"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
-"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
-xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
-"</struct>\n</value>\n</fault>";
- }
- else
- {
- if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
- {
- if (is_string($this->val) && $this->valtyp == 'xml')
- {
- $result .= "<params>\n<param>\n" .
- $this->val .
- "</param>\n</params>";
- }
- else
- {
- /// @todo try to build something serializable?
- die('cannot serialize xmlrpcresp objects whose content is native php values');
- }
- }
- else
- {
- $result .= "<params>\n<param>\n" .
- $this->val->serialize($charset_encoding) .
- "</param>\n</params>";
- }
- }
- $result .= "\n</methodResponse>";
- return $result;
- }
- }
-
- class xmlrpcmsg
- {
- var $payload;
- var $methodname;
- var $params=array();
- var $debug=0;
- var $content_type = 'text/xml';
-
- /*
- * @param string $meth the name of the method to invoke
- * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
- */
- function xmlrpcmsg($meth, $pars=0)
- {
- $this->methodname=$meth;
- if(is_array($pars) && sizeof($pars)>0)
- {
- for($i=0; $i<sizeof($pars); $i++)
- {
- $this->addParam($pars[$i]);
- }
- }
- }
-
- function xml_header()
- {
- return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
- }
-
- function xml_footer()
- {
- return "</methodCall>";
- }
-
- function kindOf()
- {
- return 'msg';
- }
-
- function createPayload($charset_encoding='')
- {
- if ($charset_encoding != '')
- $this->content_type = 'text/xml; charset=' . $charset_encoding;
- else
- $this->content_type = 'text/xml';
- $this->payload=$this->xml_header();
- $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
- // if(sizeof($this->params)) {
- $this->payload.="<params>\n";
- for($i=0; $i<sizeof($this->params); $i++)
- {
- $p=$this->params[$i];
- $this->payload.="<param>\n" . $p->serialize($charset_encoding) .
- "</param>\n";
- }
- $this->payload.="</params>\n";
- // }
- $this->payload.=$this->xml_footer();
- //$this->payload=str_replace("\n", "\r\n", $this->payload);
- }
-
- /*
- * Gets/sets the xmlrpc method to be invoked
- * @param string $meth the method to be set (leave empty not to set it)
- * @return string the method that will be invoked
- * @access public
- */
- function method($meth='')
- {
- if($meth!='')
- {
- $this->methodname=$meth;
- }
- return $this->methodname;
- }
-
- /*
- * @return string the xml representation of the message
- */
- function serialize($charset_encoding='')
- {
- $this->createPayload($charset_encoding);
- return $this->payload;
- }
-
- /*
- * Add a parameter to the list of parameters to be used upon method invocation
- * @param xmlrpcval $par
- * @return boolean false on failure
- */
- function addParam($par)
- {
- // add check: do not add to self params which are not xmlrpcvals
- if(is_object($par) && is_a($par, 'xmlrpcval'))
- {
- $this->params[]=$par;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /*
- * @param integer $i the index of the parameter to fetch (zero based)
- * @return xmlrpcval the i-th parameter
- */
- function getParam($i) { return $this->params[$i]; }
-
- /*
- * @return integer the number of parameters currently set
- */
- function getNumParams() { return sizeof($this->params); }
-
- /*
- * @access private
- * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
- */
- function &parseResponseFile($fp)
- {
- $ipd='';
- while($data=fread($fp, 32768))
- {
- $ipd.=$data;
- }
- //fclose($fp);
- $r =& $this->parseResponse($ipd);
- return $r;
- }
-
- /**
- * Parses HTTP headers and separates them from data.
- * @access private
- */
- function &parseResponseHeaders(&$data, $headers_processed=false)
- {
- // Strip HTTP 1.1 100 Continue header if present
- while(ereg('^HTTP/1\.1 1[0-9]{2} ', $data))
- {
- $pos = strpos($data, 'HTTP', 12);
- // server sent a Continue header without any (valid) content following...
- // give the client a chance to know it
- if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
- {
- break;
- }
- $data = substr($data, $pos);
- }
- if(!ereg('^HTTP/[0-9.]+ 200 ', $data))
- {
- $errstr= substr($data, 0, strpos($data, "\n")-1);
- error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr);
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
- return $r;
- }
-
- $GLOBALS['_xh']['headers'] = array();
- $GLOBALS['_xh']['cookies'] = array();
-
- // be tolerant to usage of \n instead of \r\n to separate headers and data
- // (even though it is not valid http)
- $pos = strpos($data,"\r\n\r\n");
- if($pos || is_int($pos))
- {
- $bd = $pos+4;
- }
- else
- {
- $pos = strpos($data,"\n\n");
- if($pos || is_int($pos))
- {
- $bd = $pos+2;
- }
- else
- {
- // No separation between response headers and body: fault?
- $bd = 0;
- }
- }
- // be tolerant to line endings, and extra empty lines
- $ar = split("\r?\n", trim(substr($data, 0, $pos)));
- while(list(,$line) = @each($ar))
- {
- // take care of multi-line headers and cookies
- $arr = explode(':',$line,2);
- if(count($arr) > 1)
- {
- $header_name = strtolower(trim($arr[0]));
- /// @todo some other headers (the ones that allow a CSV list of values)
- /// do allow many values to be passed using multiple header lines.
- /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
- /// instead of replacing it for those...
- if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
- {
- if ($header_name == 'set-cookie2')
- {
- // version 2 cookies:
- // there could be many cookies on one line, comma separated
- $cookies = explode(',', $arr[1]);
- }
- else
- {
- $cookies = array($arr[1]);
- }
- foreach ($cookies as $cookie)
- {
- // glue together all received cookies, using a comma to separate them
- // (same as php does with getallheaders())
- if (isset($GLOBALS['_xh']['headers'][$header_name]))
- $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
- else
- $GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
- // parse cookie attributes, in case user wants to coorectly honour then
- // feature creep: only allow rfc-compliant cookie attributes?
- $cookie = explode(';', $cookie);
- foreach ($cookie as $pos => $val)
- {
- $val = explode('=', $val, 2);
- $tag = trim($val[0]);
- $val = trim(@$val[1]);
- /// @todo with version 1 cookies, we should strip leading and trailing " chars
- if ($pos == 0)
- {
- $cookiename = $tag;
- $GLOBALS['_xh']['cookies'][$tag] = array();
- $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
- }
- else
- {
- $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
- }
- }
- }
- }
- else
- {
- $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
- }
- }
- elseif(isset($header_name))
- {
- /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
- $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
- }
- }
- // rebuild full cookie set
- /*if (isset($GLOBALS['_xh']['headers']['set-cookie']))
- {
- $cookies = array();
- $received = explode(';', $GLOBALS['_xh']['headers']['set-cookie']);
- foreach($received as $cookie)
- {
- list($name, $value) = explode('=', $cookie);
- $name = trim($name);
- $value = trim($value);
- // these values are in fact attributes
- if ($name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment')
- {
- $cookies[$name] = $value;
- }
- }
- }*/
-
- $data = substr($data, $bd);
-
- if($this->debug && count($GLOBALS['_xh']['headers']))
- {
- print '<PRE>';
- foreach($GLOBALS['_xh']['headers'] as $header => $value)
- {
- print "HEADER: $header: $value\n";
- }
- foreach($GLOBALS['_xh']['cookies'] as $header => $value)
- {
- print "COOKIE: $header={$value['value']}\n";
- }
- print "</PRE>\n";
- }
-
- // if CURL was used for the call, http headers have been processed,
- // and dechunking + reinflating have been carried out
- if(!$headers_processed)
- {
- // Decode chunked encoding sent by http 1.1 servers
- if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
- {
- if(!$data = decode_chunked($data))
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
- return $r;
- }
- }
-
- // Decode gzip-compressed stuff
- // code shamelessly inspired from nusoap library by Dietrich Ayala
- if(isset($GLOBALS['_xh']['headers']['content-encoding']))
- {
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
- {
- // if decoding works, use it. else assume data wasn't gzencoded
- if(function_exists('gzinflate'))
- {
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzinflate($data))
- {
- $data = $degzdata;
- if($this->debug)
- print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
- }
- elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
- {
- $data = $degzdata;
- if($this->debug)
- print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
- }
- else
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
- return $r;
- }
- }
- else
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
- return $r;
- }
- }
- }
- } // end of 'if needed, de-chunk, re-inflate response'
-
- // real stupid hack to avoid PHP 4 complaining about returning NULL by ref
- $r = null;
- $r =& $r;
- return $r;
- }
-
- /*
- * @param string $data the xmlrpc response, eventually including http headers
- * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and conseuqent decoding
- * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
- * @access private
- */
- function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
- {
- //$hdrfnd = 0;
- if($this->debug)
- {
- //by maHo, replaced htmlspecialchars with htmlentities
- print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
- $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
- if ($start)
- {
- $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
- $end = strpos($data, '-->', $start);
- $comments = substr($data, $start, $end-$start);
- print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
- }
- }
-
- if($data == '')
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
- return $r;
- }
-
- $GLOBALS['_xh']=array();
-
- // parse the HTTP headers of the response, if present, and separate them from data
- if(ereg("^HTTP",$data))
- {
- $r =& $this->parseResponseHeaders($data, $headers_processed);
- if ($r)
- {
- return $r;
- }
- }
- else
- {
- $GLOBALS['_xh']['headers'] = array();
- $GLOBALS['_xh']['cookies'] = array();
- }
-
-
- // be tolerant of extra whitespace in response body
- $data = trim($data);
-
- /// @todo return an error msg if $data=='' ?
-
- // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
- // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
- $bd = false;
- // Poor man's version of strrpos for php 4...
- $pos = strpos($data, '</methodResponse>');
- while($pos || is_int($pos))
- {
- $bd = $pos+17;
- $pos = strpos($data, '</methodResponse>', $bd);
- }
- if($bd)
- {
- $data = substr($data, 0, $bd);
- }
-
- // if user wants back raw xml, give it to him
- if ($return_type == 'xml')
- {
- $r =& new xmlrpcresp($data, 0, '', 'xml');
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
-
- // try to 'guestimate' the character encoding of the received response
- $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
-
- $GLOBALS['_xh']['stack'] = array();
- $GLOBALS['_xh']['valuestack'] = array();
- $GLOBALS['_xh']['isf']=0;
- $GLOBALS['_xh']['isf_reason']='';
- $GLOBALS['_xh']['ac']='';
- $GLOBALS['_xh']['qt']='';
-
- // if response charset encoding is not known / supported, try to use
- // the default encoding and parse the xml anyway, but log a warning...
- if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- // the following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
- //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding);
- $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
- }
- $parser = xml_parser_create($resp_encoding);
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
- // the xml parser to give us back data in the expected charset
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
-
- if ($return_type == 'phpvals')
- {
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
- }
- else
- {
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
- }
-
- xml_set_character_data_handler($parser, 'xmlrpc_cd');
- xml_set_default_handler($parser, 'xmlrpc_dh');
-
- if(!xml_parse($parser, $data, sizeof($data)))
- {
- // thanks to Peter Kocks <peter.kocks@baygate.com>
- if((xml_get_current_line_number($parser)) == 1)
- {
- $errstr = 'XML error at line 1, check URL';
- }
- else
- {
- $errstr = sprintf('XML error: %s at line %d',
- xml_error_string(xml_get_error_code($parser)),
- xml_get_current_line_number($parser));
- }
- error_log($errstr);
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
- xml_parser_free($parser);
- if($this->debug)
- {
- print $errstr;
- }
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
- xml_parser_free($parser);
- if ($GLOBALS['_xh']['isf'] > 1)
- {
- if ($this->debug)
- {
- /// @todo echo something for user?
- }
-
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
- $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
- }
- elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
- {
- // then something odd has happened
- // and it's time to generate a client side error
- // indicating something odd went on
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
- $GLOBALS['xmlrpcstr']['invalid_return']);
- }
- else
- {
- if ($this->debug)
- {
- print "<PRE>---PARSED---\n" ;
- var_export($GLOBALS['_xh']['value']);
- print "\n---END---</PRE>";
- } // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
-
- $v =& $GLOBALS['_xh']['value'];
-
- if($GLOBALS['_xh']['isf'])
- {
- if ($return_type == 'xmlrpcvals')
- {
- $errno_v = $v->structmem('faultCode');
- $errstr_v = $v->structmem('faultString');
- $errno = $errno_v->scalarval();
- $errstr = $errstr_v->scalarval();
- }
- else
- {
- $errno = $v['faultCode'];
- $errstr = $v['faultString'];
- }
-
- if($errno == 0)
- {
- // FAULT returned, errno needs to reflect that
- $errno = -1;
- }
-
- $r =& new xmlrpcresp($v, $errno, $errstr);
- }
- else
- {
- $r=&new xmlrpcresp($v, 0, '', 'phpvals');
- }
- }
-
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
- }
-
- class xmlrpcval
- {
- var $me=array();
- var $mytype=0;
- var $_php_class=null;
-
- function xmlrpcval($val=-1, $type='')
- {
- //$this->me=array();
- //$this->mytype=0;
- if($val!==-1 || $type!='')
- {
- if($type=='')
- {
- $type='string';
- }
- if($GLOBALS['xmlrpcTypes'][$type]==1)
- {
- $this->addScalar($val,$type);
- }
- elseif($GLOBALS['xmlrpcTypes'][$type]==2)
- {
- $this->addArray($val);
- }
- elseif($GLOBALS['xmlrpcTypes'][$type]==3)
- {
- $this->addStruct($val);
- }
- }
- }
-
- function addScalar($val, $type='string')
- {
- $typeof=@$GLOBALS['xmlrpcTypes'][$type];
- if($typeof!=1)
- {
- error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($typeof)");
- return 0;
- }
-
- // coerce booleans into correct values
- // NB: shall we do it for datetimes, integers and doubles, too?
- if($type==$GLOBALS['xmlrpcBoolean'])
- {
- if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
- {
- $val=true;
- }
- else
- {
- $val=false;
- }
- }
-
- switch($this->mytype)
- {
- case 1:
- error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value');
- return 0;
- case 3:
- error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval');
- return 0;
- case 2:
- // we're adding a scalar value to an array here
- //$ar=$this->me['array'];
- //$ar[]=&new xmlrpcval($val, $type);
- //$this->me['array']=$ar;
- // Faster (?) avoid all the costly array-copy-by-val done here...
- $this->me['array'][]=&new xmlrpcval($val, $type);
- return 1;
- default:
- // a scalar, so set the value and remember we're scalar
- $this->me[$type]=$val;
- $this->mytype=$typeof;
- return 1;
- }
- }
-
- /// @todo add some checking for $vals to be an array of xmlrpcvals?
- function addArray($vals)
- {
- if($this->mytype==0)
- {
- $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
- $this->me['array']=$vals;
- return 1;
- }
- elseif($this->mytype==2)
- {
- // we're adding to an array here
- $this->me['array'] = array_merge($this->me['array'], $vals);
- }
- else
- {
- error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']');
- return 0;
- }
- }
-
- /// @todo add some checking for $vals to be an array?
- function addStruct($vals)
- {
- if($this->mytype==0)
- {
- $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
- $this->me['struct']=$vals;
- return 1;
- }
- elseif($this->mytype==3)
- {
- // we're adding to a struct here
- $this->me['struct'] = array_merge($this->me['struct'], $vals);
- }
- else
- {
- error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']');
- return 0;
- }
- }
-
- // poor man's version of print_r ???
- // DEPRECATED!
- function dump($ar)
- {
- foreach($ar as $key => $val)
- {
- echo "$key => $val<br />";
- if($key == 'array')
- {
- while(list($key2, $val2) = each($val))
- {
- echo "-- $key2 => $val2<br />";
- }
- }
- }
- }
-
- function kindOf()
- {
- switch($this->mytype)
- {
- case 3:
- return 'struct';
- break;
- case 2:
- return 'array';
- break;
- case 1:
- return 'scalar';
- break;
- default:
- return 'undef';
- }
- }
-
- function serializedata($typ, $val, $charset_encoding='')
- {
- $rs='';
- switch(@$GLOBALS['xmlrpcTypes'][$typ])
- {
- case 3:
- // struct
- if ($this->_php_class)
- {
- $rs.='<struct php_class="' . $this->_php_class . "\">\n";
- }
- else
- {
- $rs.="<struct>\n";
- }
- foreach($val as $key2 => $val2)
- {
- $rs.="<member><name>${key2}</name>\n";
- //$rs.=$this->serializeval($val2);
- $rs.=$val2->serialize();
- $rs.="</member>\n";
- }
- $rs.='</struct>';
- break;
- case 2:
- // array
- $rs.="<array>\n<data>\n";
- for($i=0; $i<sizeof($val); $i++)
- {
- //$rs.=$this->serializeval($val[$i]);
- $rs.=$val[$i]->serialize();
- }
- $rs.="</data>\n</array>";
- break;
- case 1:
- switch($typ)
- {
- case $GLOBALS['xmlrpcBase64']:
- $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
- break;
- case $GLOBALS['xmlrpcBoolean']:
- $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
- break;
- case $GLOBALS['xmlrpcString']:
- // G. Giunta 2005/2/13: do NOT use htmlentities, since
- // it will produce named html entities, which are invalid xml
- $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
- // $rs.="<${typ}>" . htmlentities($val). "</${typ}>";
- break;
- case $GLOBALS['xmlrpcInt']:
- case $GLOBALS['xmlrpcI4']:
- $rs.="<${typ}>".(int)$val."</${typ}>";
- break;
- case $GLOBALS['xmlrpcDouble']:
- $rs.="<${typ}>".(double)$val."</${typ}>";
- break;
- default:
- // no standard type value should arrive here, but provide a possibility
- // for xmlrpcvals of unknown type...
- $rs.="<${typ}>${val}</${typ}>";
- }
- break;
- default:
- break;
- }
- return $rs;
- }
-
- /**
- * Return xml representation of the value
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
- */
- function serialize($charset_encoding='')
- {
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
- //{
- reset($this->me);
- list($typ, $val) = each($this->me);
- return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
- //}
- }
-
- // DEPRECATED
- function serializeval($o)
- {
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
- //{
- $ar=$o->me;
- reset($ar);
- list($typ, $val) = each($ar);
- return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
- //}
- }
-
- /**
- * Checks wheter a struct member with a given name is present.
- * Works only on xmlrpcvals of type struct.
- * @param string $m the name of the struct member to be looked up
- * @return boolean
- */
- function structmemexists($m)
- {
- return array_key_exists($this->me['struct'][$m]);
- }
-
- /*
- * Returns the value of a given struct member (an xmlrpcval object in itself).
- * Will raise a php warning if struct member of given name does not exist
- * @param string $m the name of the struct member to be looked up
- * @return xmlrpcval
- */
- function structmem($m)
- {
- return $this->me['struct'][$m];
- }
-
- function structreset()
- {
- reset($this->me['struct']);
- }
-
- function structeach()
- {
- return each($this->me['struct']);
- }
-
- // DEPRECATED! this code looks like it is very fragile and has not been fixed
- // for a long long time. Shall we remove it for 2.0?
- function getval()
- {
- // UNSTABLE
- reset($this->me);
- list($a,$b)=each($this->me);
- // contributed by I Sofer, 2001-03-24
- // add support for nested arrays to scalarval
- // i've created a new method here, so as to
- // preserve back compatibility
-
- if(is_array($b))
- {
- @reset($b);
- while(list($id,$cont) = @each($b))
- {
- $b[$id] = $cont->scalarval();
- }
- }
-
- // add support for structures directly encoding php objects
- if(is_object($b))
- {
- $t = get_object_vars($b);
- @reset($t);
- while(list($id,$cont) = @each($t))
- {
- $t[$id] = $cont->scalarval();
- }
- @reset($t);
- while(list($id,$cont) = @each($t))
- {
- //@eval('$b->'.$id.' = $cont;');
- @$b->$id = $cont;
- }
- }
- // end contrib
- return $b;
- }
-
- /**
- * Returns the value of a scalar xmlrpcval
- * @return mixed
- */
- function scalarval()
- {
- reset($this->me);
- list(,$b)=each($this->me);
- return $b;
- }
-
- /**
- * Returns the type of the xmlrpcval.
- * For integers, 'int' is always returned in place of 'i4'
- * @return string
- */
- function scalartyp()
- {
- reset($this->me);
- list($a,$b)=each($this->me);
- if($a==$GLOBALS['xmlrpcI4'])
- {
- $a=$GLOBALS['xmlrpcInt'];
- }
- return $a;
- }
-
- /**
- * Returns the m-th member of an xmlrpcval of struct type
- * @param integer $m the index of the value to be retrieved (zero based)
- * @return xmlrpcval
- */
- function arraymem($m)
- {
- return $this->me['array'][$m];
- }
-
- /**
- * Returns the number of members in an xmlrpcval of array type
- * @return integer
- */
- function arraysize()
- {
- return count($this->me['array']);
- }
-
- /**
- * Returns the number of members in an xmlrpcval of struct type
- * @return integer
- */
- function structsize()
- {
- return count($this->me['struct']);
- }
- }
-
-
- // date helpers
- function iso8601_encode($timet, $utc=0)
- {
- // return an ISO8601 encoded string
- // really, timezones ought to be supported
- // but the XML-RPC spec says:
- //
- // "Don't assume a timezone. It should be specified by the server in its
- // documentation what assumptions it makes about timezones."
- //
- // these routines always assume localtime unless
- // $utc is set to 1, in which case UTC is assumed
- // and an adjustment for locale is made when encoding
- if(!$utc)
- {
- $t=strftime("%Y%m%dT%H:%M:%S", $timet);
- }
- else
- {
- if(function_exists('gmstrftime'))
- {
- // gmstrftime doesn't exist in some versions
- // of PHP
- $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
- }
- else
- {
- $t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
- }
- }
- return $t;
- }
-
- function iso8601_decode($idate, $utc=0)
- {
- // return a timet in the localtime, or UTC
- $t=0;
- if(ereg("([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $idate, $regs))
- {
- if($utc)
- {
- $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
- }
- else
- {
- $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
- }
- }
- return $t;
- }
-
- /**
- * Takes an xmlrpc value in PHP xmlrpcval object format
- * and translates it into native PHP types.
- * Works with xmlrpc message objects as input, too.
- *
- * @author Dan Libby (dan@libby.com)
- *
- * @param xmlrpcval $xmlrpc_val
- * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
- * @return mixed
- */
- function php_xmlrpc_decode($xmlrpc_val, $options=array())
- {
- switch($xmlrpc_val->kindOf())
- {
- case 'scalar':
- return $xmlrpc_val->scalarval();
- case 'array':
- $size = $xmlrpc_val->arraysize();
- $arr = array();
- for($i = 0; $i < $size; $i++)
- {
- $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
- }
- return $arr;
- case 'struct':
- $xmlrpc_val->structreset();
- // If user said so, try to rebuild php objects for specific struct vals.
- /// @todo should we raise a warning for class not found?
- // shall we check for proper subclass of xmlrpcval instead of
- // presence of _php_class to detect what we can do?
- if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
- && class_exists($xmlrpc_val->_php_class))
- {
- $obj = @new $xmlrpc_val->_php_class;
- while(list($key,$value)=$xmlrpc_val->structeach())
- {
- $obj->$key = php_xmlrpc_decode($value, $options);
- }
- return $obj;
- }
- else
- {
- $arr = array();
- while(list($key,$value)=$xmlrpc_val->structeach())
- {
- $arr[$key] = php_xmlrpc_decode($value, $options);
- }
- return $arr;
- }
- case 'msg':
- $paramcount = $xmlrpc_val->getNumParams();
- $arr = array();
- for($i = 0; $i < $paramcount; $i++)
- {
- $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
- }
- return $arr;
- }
- }
-
- if(function_exists('xmlrpc_decode'))
- {
- define('XMLRPC_EPI_ENABLED','1');
- }
- else
- {
- define('XMLRPC_EPI_ENABLED','0');
- }
-
- /**
- * Takes native php types and encodes them into xmlrpc PHP object format.
- * It will not re-encode xmlrpcval objects.
- * Feature creep -- could support more types via optional type argument
- * (string => datetime support has been added, ??? => base64 not yet)
- *
- * @author Dan Libby (dan@libby.com)
- *
- * @param mixed $php_val the value to be converted into an xmlrpcval object
- * @param array $options can include 'encode_php_objs' and 'auto_dates'
- * @return xmlrpcval
- */
- function &php_xmlrpc_encode($php_val, $options=array())
- {
- $type = gettype($php_val);
- $xmlrpc_val =& new xmlrpcval;
-
- switch($type)
- {
- case 'array':
- // PHP arrays can be encoded to either xmlrpc structs or arrays,
- // depending on wheter they are hashes or plain 0..n integer indexed
- // A shorter one-liner would be
- // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));
- // but execution time skyrockets!
- $j = 0;
- $arr = array();
- $ko = false;
- foreach($php_val as $key => $val)
- {
- $arr[$key] =& php_xmlrpc_encode($val, $options);
- if(!$ko && $key !== $j)
- {
- $ko = true;
- }
- $j++;
- }
- if($ko)
- {
- $xmlrpc_val->addStruct($arr);
- }
- else
- {
- $xmlrpc_val->addArray($arr);
- }
- break;
- case 'object':
- if(is_a($php_val, 'xmlrpcval'))
- {
- $xmlrpc_val = $php_val;
- }
- else
- {
- $arr = array();
- while(list($k,$v) = each($php_val))
- {
- $arr[$k] = php_xmlrpc_encode($v, $options);
- }
- $xmlrpc_val->addStruct($arr);
- if (in_array('encode_php_objs', $options))
- {
- // let's save original class name into xmlrpcval:
- // might be useful later on...
- $xmlrpc_val->_php_class = get_class($php_val);
- }
- }
- break;
- case 'integer':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcInt']);
- break;
- case 'double':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcDouble']);
- break;
- case 'string':
- if (in_array('auto_dates', $options) && ereg("^[0-9]{8}\T{1}[0-9]{2}\:[0-9]{2}\:[0-9]{2}$", $php_val))
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcDateTime']);
- else
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcString']);
- break;
- // <G_Giunta_2001-02-29>
- // Add support for encoding/decoding of booleans, since they are supported in PHP
- case 'boolean':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcBoolean']);
- break;
- // </G_Giunta_2001-02-29>
- // catch "resource", "NULL", "user function", "unknown type"
- //case 'unknown type':
- default:
- // giancarlo pinerolo <ping@alt.it>
- // it has to return
- // an empty object in case (which is already
- // at this point), not a boolean.
- break;
- }
- return $xmlrpc_val;
- }
-
- /**
- * decode a string that is encoded w/ "chunked" transfer encoding
- * as defined in rfc2068 par. 19.4.6
- * code shamelessly stolen from nusoap library by Dietrich Ayala
- *
- * @param string $buffer the string to be decoded
- * @return string
- */
- function decode_chunked($buffer)
- {
- // length := 0
- $length = 0;
- $new = '';
-
- // read chunk-size, chunk-extension (if any) and crlf
- // get the position of the linebreak
- $chunkend = strpos($buffer,"\r\n") + 2;
- $temp = substr($buffer,0,$chunkend);
- $chunk_size = hexdec( trim($temp) );
- $chunkstart = $chunkend;
- // while(chunk-size > 0) {
- while($chunk_size > 0)
- {
- $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
-
- // just in case we got a broken connection
- if($chunkend == false)
- {
- $chunk = substr($buffer,$chunkstart);
- // append chunk-data to entity-body
- $new .= $chunk;
- $length += strlen($chunk);
- break;
- }
-
- // read chunk-data and crlf
- $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
- // append chunk-data to entity-body
- $new .= $chunk;
- // length := length + chunk-size
- $length += strlen($chunk);
- // read chunk-size and crlf
- $chunkstart = $chunkend + 2;
-
- $chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
- if($chunkend == false)
- {
- break; //just in case we got a broken connection
- }
- $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
- $chunk_size = hexdec( trim($temp) );
- $chunkstart = $chunkend;
- }
- return $new;
- }
-
- /**
- * Given a string defining a php type or phpxmlrpc type (loosely defined: strings
- * accepted come from javadoc blocks), return corresponding phpxmlrpc type.
- * NB: for php 'resource' types returns empty string, since resources cannot be serialized;
- * for php class names returns 'struct', since php objects can be serialized as xmlrpc structs
- * @param string $phptype
- * @return string
- */
- function php_2_xmlrpc_type($phptype)
- {
- switch(strtolower($phptype))
- {
- case 'string':
- return $GLOBALS['xmlrpcString'];
- case 'integer':
- case $GLOBALS['xmlrpcInt']: // 'int'
- case $GLOBALS['xmlrpcI4']:
- return $GLOBALS['xmlrpcInt'];
- case 'double':
- return $GLOBALS['xmlrpcDouble'];
- case 'boolean':
- return $GLOBALS['xmlrpcBoolean'];
- case 'array':
- return $GLOBALS['xmlrpcArray'];
- case 'object':
- return $GLOBALS['xmlrpcStruct'];
- case $GLOBALS['xmlrpcBase64']:
- case $GLOBALS['xmlrpcStruct']:
- return strtolower($phptype);
- case 'resource':
- return '';
- default:
- if(class_exists($phptype))
- {
- return $GLOBALS['xmlrpcStruct'];
- }
- else
- {
- // unknown: might be any xmlrpc type
- return $GLOBALS['xmlrpcValue'];
- }
- }
- }
-
- /**
- * Given a user-defined PHP function, create a PHP 'wrapper' function that can
- * be exposed as xmlrpc method from an xmlrpc_server object and called from remote
- * clients.
- *
- * Since php is a typeless language, to infer types of input and output parameters,
- * it relies on parsing the javadoc-style comment block associated with the given
- * function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64)
- * in the @param tag is also allowed, if you need the php function to receive/send
- * data in that particular format (note that base64 enncoding/decoding is transparently
- * carried out by the lib, while datetime vals are passed around as strings)
- *
- * Known limitations:
- * - requires PHP 5.0.3 +
- * - only works for user-defined functions, not for PHP internal functions
- * (reflection does not support retrieving number/type of params for those)
- * - functions returning php objects will generate special xmlrpc responses:
- * when the xmlrpc decoding of those responses is carried out by this same lib, using
- * the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt.
- * In short: php objects can be serialized, too (except for their resource members),
- * using this function.
- * Other libs might choke on the very same xml that will be generated in this case
- * (i.e. it has a nonstandard attribute on struct element tags)
- * - usage of javadoc @param tags using param names in a different order from the
- * function prototype is not considered valid (to be fixed?)
- *
- * Note that since rel. 2.0RC3 the preferred method to have the server call 'standard'
- * php functions (ie. functions not expecting a single xmlrpcmsg obj as parameter)
- * is by making use of the functions_parameters_type class member.
- *
- * @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') might be ok too, in the future...
- * @return false on error, or an array containing the name of the new php function,
- * its signature and docs, to be used in the server dispatch map
- *
- * @todo decide how to deal with params passed by ref: bomb out or allow?
- * @todo finish using javadoc info to build method sig if all params are named but out of order
- * @done switch to some automagic object encoding scheme
- * @todo add a check for params of 'resource' type
- * @todo add some trigger_errors when returning false?
- * @todo what to do when the PHP function returns NULL? we are currently returning bogus responses!!!
- */
- function wrap_php_function($funcname, $newfuncname='')
- {
- if(version_compare(phpversion(), '5.0.3') == -1)
- {
- // up to php 5.0.3 some useful reflection methods were missing
- return false;
- }
- if((is_array($funcname) && !method_exists($funcname[0], $funcname[1])) || !function_exists($funcname))
- {
- return false;
- }
- else
- {
- // determine name of new php function
- if($newfuncname == '')
- {
- if(is_array($funcname))
- {
- $xmlrpcfuncname = "xmlrpc_".implode('_', $funcname);
- }
- else
- {
- $xmlrpcfuncname = "xmlrpc_$funcname";
- }
- }
- else
- {
- $xmlrpcfuncname = $newfuncname;
- }
- while(function_exists($xmlrpcfuncname))
- {
- $xmlrpcfuncname .= 'x';
- }
- $code = "function $xmlrpcfuncname(\$msg) {\n";
-
- // start to introspect PHP code
- $func =& new ReflectionFunction($funcname);
- if($func->isInternal())
- {
- // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
- // instead of getparameters to fully reflect internal php functions ?
- return false;
- }
-
- // retrieve parameter names, types and description from javadoc comments
-
- // function description
- $desc = '';
- // type of return val: by default 'any'
- $returns = $GLOBALS['xmlrpcValue'];
- // type + name of function parameters
- $paramDocs = array();
-
- $docs = $func->getDocComment();
- if($docs != '')
- {
- $docs = explode("\n", $docs);
- $i = 0;
- foreach($docs as $doc)
- {
- $doc = trim($doc, " \r\t/*");
- if(strlen($doc) && strpos($doc, '@') !== 0 && !$i)
- {
- if($desc)
- {
- $desc .= "\n";
- }
- $desc .= $doc;
- }
- elseif(strpos($doc, '@param') === 0)
- {
- // syntax: @param type [$name] desc
- if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
- {
- if(strpos($matches[1], '|'))
- {
- //$paramDocs[$i]['type'] = explode('|', $matches[1]);
- $paramDocs[$i]['type'] = 'mixed';
- }
- else
- {
- $paramDocs[$i]['type'] = $matches[1];
- }
- $paramDocs[$i]['name'] = trim($matches[2]);
- $paramDocs[$i]['doc'] = $matches[3];
- }
- $i++;
- }
- elseif(strpos($doc, '@return') === 0)
- {
- $returns = preg_split("/\s+/", $doc);
- if(isset($returns[1]))
- {
- $returns = php_2_xmlrpc_type($returns[1]);
- }
- }
- }
- }
-
- // start introspection of actual function prototype and building of PHP code
- // to be eval'd
- $params = $func->getParameters();
-
- $innercode = '';
- $i = 0;
- $parsvariations = array();
- $pars = array();
- $pnum = count($params);
- foreach($params as $param)
- {
- if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != '$'.strtolower($param->getName()))
- {
- // param name from phpdoc info does not match param definition!
- $paramDocs[$i]['type'] = 'mixed';
- }
-
- if($param->isOptional())
- {
- // this particular parameter is optional. save as valid previous list of parameters
- $innercode .= "if (\$paramcount > $i) {\n";
- $parsvariations[] = $pars;
- }
- $innercode .= "\$p$i = \$msg->getParam($i);\n";
- $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_xmlrpc_decode(\$p$i);\n";
- $pars[] = "\$p$i";
- $i++;
- if($param->isOptional())
- {
- $innercode .= "}\n";
- }
- if($i == $pnum)
- {
- // last allowed parameters combination
- $parsvariations[] = $pars;
- }
- }
-
- $sigs = array();
- if(count($parsvariations) == 0)
- {
- // only known good synopsis = no parameters
- $parsvariations[] = array();
- $minpars = 0;
- }
- else
- {
- $minpars = count($parsvariations[0]);
- }
-
- if($minpars)
- {
- // add to code the check for min params number
- // NB: this check needs to be done BEFORE decoding param values
- $innercode = "\$paramcount = \$msg->getNumParams();\n" .
- "if (\$paramcount < $minpars) return new xmlrpcresp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
- }
- else
- {
- $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
- }
-
- $innercode .= "\$np = false;";
- foreach($parsvariations as $pars)
- {
- $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = $funcname(" . implode(',', $pars) . "); else\n";
- // build a 'generic' signature (only use an appropriate return type)
- $sig = array($returns);
- for($i=0; $i < count($pars); $i++)
- {
- if (isset($paramDocs[$i]['type']))
- {
- $sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
- }
- else
- {
- $sig[] = $GLOBALS['xmlrpcValue'];
- }
- }
- $sigs[] = $sig;
- }
- $innercode .= "\$np = true;\n";
- $innercode .= "if (\$np) return new xmlrpcresp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else\n";
- //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n";
- if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
- {
- $innercode .= "return new xmlrpcresp(new xmlrpcval(\$retval, '$returns'));";
- }
- else
- {
- $innercode .= "return new xmlrpcresp(php_xmlrpc_encode(\$retval, array('encode_php_objs')));";
- }
- // shall we exclude functions returning by ref?
- // if($func->returnsReference())
- // return false;
- $code = $code . $innercode . "\n}\n \$allOK=1;";
- //print_r($code);
- $allOK = 0;
- eval($code);
- // alternative
- //$xmlrpcfuncname = create_function('$m', $innercode);
-
- if(!$allOK)
- {
- return false;
- }
-
- /// @todo examine if $paramDocs matches $parsvariations and build array for
- /// usage as method signature, plus put together a nice string for docs
-
- $ret = array('function' => $xmlrpcfuncname, 'signature' => $sigs, 'docstring' => $desc);
- return $ret;
- }
- }
-
- /**
- * Given an xmlrpc client and a method name, register a php wrapper function
- * that will call it and return results using native php types for both
- * params and results. The generated php function will return an xmlrpcresp
- * oject for failed xmlrpc calls
- *
- * Known limitations:
- * - server must support system.methodsignature for the wanted xmlrpc method
- * - for methods that expose many signatures, only one can be picked (we
- * could in priciple check if signatures differ only by number of params
- * and not by type, but it would be more complication than we can spare time)
- * - nested xmlrpc params: the caller of the generated php function has to
- * encode on its own the params passed to the php function if these are structs
- * or arrays whose (sub)members include values of type datetime or base64
- *
- * Notes: the connection properties of the given client will be copied
- * and reused for the connection used during the call to the generated
- * php function.
- * Calling the generated php function 'might' be slow: a new xmlrpc client
- * is created on every invocation and an xmlrpc-connection opened+closed.
- * An extra 'debug' param is appended to param list of xmlrpc method, useful
- * for debugging purposes.
- *
- * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server
- * @param string $methodname the xmlrpc method to be mapped to a php function
- * @param integer $signum the index of the method signature to use in mapping (if method exposes many sigs)
- * @return string the name of the generated php function (or false)
- */
- function wrap_xmlrpc_method($client, $methodname, $signum=0, $timeout=0, $protocol='', $newfuncname='')
- {
- $msg =& new xmlrpcmsg('system.methodSignature');
- $msg->addparam(new xmlrpcval($methodname));
- $response =& $client->send($msg, $timeout, $protocol);
- if(!$response || $response->faultCode())
- {
- return false;
- }
- else
- {
- $desc = $response->value();
- if($desc->kindOf() != 'array' || $desc->arraysize() <= $signum)
- {
- return false;
- }
- else
- {
- if($newfuncname != '')
- {
- $xmlrpcfuncname = $newfuncname;
- }
- else
- {
- $xmlrpcfuncname = 'xmlrpc_'.str_replace('.', '_', $methodname);
- }
- while(function_exists($xmlrpcfuncname))
- {
- $xmlrpcfuncname .= 'x';
- }
- $desc = $desc->arraymem($signum);
- $code = "function $xmlrpcfuncname (";
- $innercode = "\$client =& new xmlrpc_client('$client->path', '$client->server');\n";
- // copy all client fields to the client that will be generated runtime
- // (this provides for future expansion of client obj)
- foreach($client as $fld => $val)
- {
- if($fld != 'debug' && $fld != 'return_type')
- {
- $val = var_export($val, true);
- $innercode .= "\$client->$fld = $val;\n";
- }
- }
- $innercode .= "\$client->setDebug(\$debug);\n";
- $innercode .= "\$client->return_type = 'xmlrpcvals';\n";
- $innercode .= "\$msg =& new xmlrpcmsg('$methodname');\n";
-
- // param parsing
- $plist = array();
- $pcount = $desc->arraysize();
- for($i = 1; $i < $pcount; $i++)
- {
- $plist[] = "\$p$i";
- $ptype = $desc->arraymem($i);
- $ptype = $ptype->scalarval();
- if($ptype == 'dateTime.iso8601' || $ptype == 'base64')
- {
- $innercode .= "\$p$i =& new xmlrpcval(\$p$i, '$ptype');\n";
- }
- else
- {
- $innercode .= "\$p$i =& php_xmlrpc_encode(\$p$i);\n";
- }
- $innercode .= "\$msg->addparam(\$p$i);\n";
- }
- $plist[] = '$debug = 0';
- $plist = implode(',', $plist);
-
- $innercode .= "\$res =& \$client->send(\$msg, $timeout, '$protocol');\n";
- $innercode .= "if (\$res->faultcode()) return \$res; else return php_xmlrpc_decode(\$res->value(), array('decode_php_objs'));";
-
- $code = $code . $plist. ") {\n" . $innercode . "\n}\n\$allOK=1;";
- //print_r($code);
- $allOK = 0;
- eval($code);
- // alternative
- //$xmlrpcfuncname = create_function('$m', $innercode);
- if($allOK)
- {
- return $xmlrpcfuncname;
- }
- else
- {
- return false;
- }
- }
- }
- }
-
- /**
- * xml charset encoding guessing helper function.
- * Tries to determine the charset encoding of an XML chunk
- * received over HTTP.
-
- * NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,
-
- * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
-
- * which will be most probably using UTF-8 anyway...
- *
- * @param string $httpheaders the http Content-type header
- * @param string $xmlchunk xml content buffer
- * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
- *
- * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
- */
- function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
- {
- // discussion: see http://www.yale.edu/pclt/encoding/
- // 1 - test if encoding is specified in HTTP HEADERS
-
- //Details:
- // LWS: (\13\10)?( |\t)+
- // token: (any char but excluded stuff)+
- // header: Content-type = ...; charset=value(; ...)*
- // where value is of type token, no LWS allowed between 'charset' and value
- // Note: we do not check for invalid chars in VALUE:
- // this had better be done using pure ereg as below
-
- /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
- if(eregi(";((\\xD\\xA)?[ \\x9]+)*charset=", $httpheader))
- {
- /// @BUG if charset is received uppercase, this line will fail!
- $in = strpos($httpheader, 'charset=')+8;
- $out = strpos($httpheader, ';', $in) ? strpos($httpheader, ';', $in) : strlen($httpheader);
- return strtoupper(trim(substr($httpheader, $in, $out-$in)));
- }
-
- // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern
- // (source: http://www.w3.org/TR/2000/REC-xml-20001006)
- // NOTE: actually, according to the spec, even if we find the BOM and determine
- // an encoding, we should check if there is an encoding specified
- // in the xml declaration, and verify if they match.
- /// @todo implement check as described above?
- /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
- if(@ereg("^(\\x00\\x00\\xFE\\xFF|\\xFF\\xFE\\x00\\x00|\\x00\\x00\\xFF\\xFE|\\xFE\\xFF\\x00\\x00)", $xmlchunk))
- // if (preg_match("/^(\\x00\\x00\\xFE\\xFF|\\xFF\\xFE\\x00\\x00|\\x00\\x00\\xFF\\xFE|\\xFE\\xFF\\x00\\x00)/", $xmlchunk))
- {
- return 'UCS-4';
- }
- elseif(ereg("^(\\xFE\\xFF|\\xFF\\xFE)", $xmlchunk))
- {
- return 'UTF-16';
- }
- elseif(ereg("^(\\xEF\\xBB\\xBF)", $xmlchunk))
- {
- return 'UTF-8';
- }
-
- // 3 - test if encoding is specified in the xml declaration
- // Details:
- // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
- // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
- if (ereg("^<\?xml".
- "[ \\x9\\xD\\xA]+" . "version" . "[ \\x9\\xD\\xA]*=[ \\x9\\xD\\xA]*" . "((\"[a-zA-Z0-9_.:-]+\")|('[a-zA-Z0-9_.:-]+'))".
- "[ \\x9\\xD\\xA]+" . "encoding" . "[ \\x9\\xD\\xA]*=[ \\x9\\xD\\xA]*" . "((\"[A-Za-z][A-Za-z0-9._-]*\")|('[A-Za-z][A-Za-z0-9._-]*'))",
- $xmlchunk, $regs))
- {
- return strtoupper(substr($regs[4], 1, strlen($regs[4])-2));
- }
-
- // 4 - if mbstring is available, let it do the guesswork
- // NB: we favour finding an encoding that is compatible with what we can process
- if(extension_loaded('mbstring'))
- {
- if($encoding_prefs)
- {
- $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
- }
- else
- {
- $enc = mb_detect_encoding($xmlchunk);
- }
- // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
- // IANA also likes better US-ASCII, so go with it
- if($enc == 'ASCII')
- {
- $enc = 'US-'.$enc;
- }
- return $enc;
- }
- else
- {
- // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
- // Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types
- // this should be the standard. And we should be getting text/xml as request and response.
- // BUT we have to be backward compatible with the lib, which always used UTF-8 as default...
- return $GLOBALS['xmlrpc_defencoding'];
- }
- }
-
-/**
-* Checks if a given charset encoding is present in a list of encodings or
-* if it is a valid subset of any encoding in the list
-* @param string $encoding charset to be tested
-* @param mixed $validlist comma separated list of valid charsets (or array of charsets)
-*/
-function is_valid_charset($encoding, $validlist)
-{
- $charset_supersets = array(
- 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
- 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
- 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
- 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
- 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
- );
- if (is_string($validlist))
- $validlist = split(',', $validlist);
- if (@in_array(strtoupper($encoding), $validlist))
- return true;
- else
- {
- if (array_key_exists($encoding, $charset_supersets))
- foreach ($validlist as $allowed)
- if (in_array($allowed, $charset_supersets[$encoding]))
- return true;
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/addons/esale_joomla/connector/xmlrpcs.inc b/addons/esale_joomla/connector/xmlrpcs.inc
deleted file mode 100644
index c7a9da90a10..00000000000
--- a/addons/esale_joomla/connector/xmlrpcs.inc
+++ /dev/null
@@ -1,1040 +0,0 @@
-<?php
-// by Edd Dumbill (C) 1999-2002
-// <edd@usefulinc.com>
-// $Id: xmlrpcs.inc,v 1.52 2006/01/19 23:48:58 ggiunta Exp $
-
-// Copyright (c) 1999,2000,2002 Edd Dumbill.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// * Neither the name of the "XML-RPC for PHP" nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
- // XML RPC Server class
- // requires: xmlrpc.inc
-
- // listMethods: signature was either a string, or nothing.
- // The useless string variant has been removed
- $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));
- $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
- function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
- {
-
- $outAr=array();
- foreach($server->dmap as $key => $val)
- {
- $outAr[]=&new xmlrpcval($key, 'string');
- }
- if($server->allow_system_funcs)
- {
- foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)
- {
- $outAr[]=&new xmlrpcval($key, 'string');
- }
- }
- $v=&new xmlrpcval($outAr, 'array');
- return new xmlrpcresp($v);
- }
-
- $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString']));
- $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
- function _xmlrpcs_methodSignature($server, $m)
- {
- // let accept as parameter both an xmlrpcval or string
- if (is_object($m))
- {
- $methName=$m->getParam(0);
- $methName=$methName->scalarval();
- }
- else
- {
- $methName=$m;
- }
- if(ereg("^system\.", $methName))
- {
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
- }
- else
- {
- $dmap=$server->dmap; $sysCall=0;
- }
- // print "<!-- ${methName} -->\n";
- if(isset($dmap[$methName]))
- {
- if(isset($dmap[$methName]['signature']))
- {
- $sigs=array();
- foreach($dmap[$methName]['signature'] as $inSig)
- {
- $cursig=array();
- foreach($inSig as $sig)
- {
- $cursig[]=&new xmlrpcval($sig, 'string');
- }
- $sigs[]=&new xmlrpcval($cursig, 'array');
- }
- $r=&new xmlrpcresp(new xmlrpcval($sigs, 'array'));
- }
- else
- {
- // NB: according to the official docs, we should be returning a
- // "none-array" here, which means not-an-array
- $r=&new xmlrpcresp(new xmlrpcval('undef', 'string'));
- }
- }
- else
- {
- $r=&new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
- }
- return $r;
- }
-
- $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
- $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
- function _xmlrpcs_methodHelp($server, $m)
- {
- // let accept as parameter both an xmlrpcval or string
- if (is_object($m))
- {
- $methName=$m->getParam(0);
- $methName=$methName->scalarval();
- }
- else
- {
- $methName=$m;
- }
- if(ereg("^system\.", $methName))
- {
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
- }
- else
- {
- $dmap=$server->dmap; $sysCall=0;
- }
- // print "<!-- ${methName} -->\n";
- if(isset($dmap[$methName]))
- {
- if(isset($dmap[$methName]['docstring']))
- {
- $r=&new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
- }
- else
- {
- $r=&new xmlrpcresp(new xmlrpcval('', 'string'));
- }
- }
- else
- {
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
- }
- return $r;
- }
-
- $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray']));
- $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
-
- function _xmlrpcs_multicall_error($err)
- {
- if(is_string($err))
- {
- $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];
- $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];
- }
- else
- {
- $code = $err->faultCode();
- $str = $err->faultString();
- }
- $struct = array();
- $struct['faultCode'] =& new xmlrpcval($code, 'int');
- $struct['faultString'] =& new xmlrpcval($str, 'string');
- return new xmlrpcval($struct, 'struct');
- }
-
- function _xmlrpcs_multicall_do_call($server, $call)
- {
- if($call->kindOf() != 'struct')
- {
- return _xmlrpcs_multicall_error('notstruct');
- }
- $methName = @$call->structmem('methodName');
- if(!$methName)
- {
- return _xmlrpcs_multicall_error('nomethod');
- }
- if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')
- {
- return _xmlrpcs_multicall_error('notstring');
- }
- if($methName->scalarval() == 'system.multicall')
- {
- return _xmlrpcs_multicall_error('recursion');
- }
-
- $params = @$call->structmem('params');
- if(!$params)
- {
- return _xmlrpcs_multicall_error('noparams');
- }
- if($params->kindOf() != 'array')
- {
- return _xmlrpcs_multicall_error('notarray');
- }
- $numParams = $params->arraysize();
-
- $msg =& new xmlrpcmsg($methName->scalarval());
- for($i = 0; $i < $numParams; $i++)
- {
- if(!$msg->addParam($params->arraymem($i)))
- {
- $i++;
- return _xmlrpcs_multicall_error(new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['incorrect_params'],
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i));
- }
- }
-
- $result = $server->execute($msg);
-
- if($result->faultCode() != 0)
- {
- return _xmlrpcs_multicall_error($result); // Method returned fault.
- }
-
- return new xmlrpcval(array($result->value()), 'array');
- }
-
- function _xmlrpcs_multicall_do_call_phpvals($server, $call)
- {
- if(!is_array($call))
- {
- return _xmlrpcs_multicall_error('notstruct');
- }
- if(!array_key_exists('methodName', $call))
- {
- return _xmlrpcs_multicall_error('nomethod');
- }
- if (!is_string($call['methodName']))
- {
- return _xmlrpcs_multicall_error('notstring');
- }
- if($call['methodName'] == 'system.multicall')
- {
- return _xmlrpcs_multicall_error('recursion');
- }
- if(!array_key_exists('params', $call))
- {
- return _xmlrpcs_multicall_error('noparams');
- }
- if(!is_array($call['params']))
- {
- return _xmlrpcs_multicall_error('notarray');
- }
-
- // this is a real dirty and simplistic hack, since we might have received a
- // base64 or datetime values, but they will be listed as strings here...
- $numParams = count($call['params']);
- $pt = array();
- foreach($call['params'] as $val)
- $pt[] = php_2_xmlrpc_type(gettype($val));
-
- $result = $server->execute($call['methodName'], $call['params'], $pt);
-
- if($result->faultCode() != 0)
- {
- return _xmlrpcs_multicall_error($result); // Method returned fault.
- }
-
- return new xmlrpcval(array($result->value()), 'array');
- }
-
- function _xmlrpcs_multicall($server, $m)
- {
- $result = array();
- // let accept a plain list of php parameters, beside a single xmlrpc msg object
- if (is_object($m))
- {
- $calls = $m->getParam(0);
- $numCalls = $calls->arraysize();
- for($i = 0; $i < $numCalls; $i++)
- {
- $call = $calls->arraymem($i);
- $result[$i] = _xmlrpcs_multicall_do_call($server, $call);
- }
- }
- else
- {
- //$calls = func_get_args();
- $numCalls=count($m);
- for($i = 0; $i < $numCalls; $i++)
- {
- $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);
- }
- }
-
- return new xmlrpcresp(new xmlrpcval($result, 'array'));
- }
-
- $GLOBALS['_xmlrpcs_dmap']=array(
- 'system.listMethods' => array(
- 'function' => '_xmlrpcs_listMethods',
- 'signature' => $_xmlrpcs_listMethods_sig,
- 'docstring' => $_xmlrpcs_listMethods_doc),
- 'system.methodHelp' => array(
- 'function' => '_xmlrpcs_methodHelp',
- 'signature' => $_xmlrpcs_methodHelp_sig,
- 'docstring' => $_xmlrpcs_methodHelp_doc),
- 'system.methodSignature' => array(
- 'function' => '_xmlrpcs_methodSignature',
- 'signature' => $_xmlrpcs_methodSignature_sig,
- 'docstring' => $_xmlrpcs_methodSignature_doc),
- 'system.multicall' => array(
- 'function' => '_xmlrpcs_multicall',
- 'signature' => $_xmlrpcs_multicall_sig,
- 'docstring' => $_xmlrpcs_multicall_doc
- )
- );
-
- $GLOBALS['_xmlrpcs_occurred_errors'] = '';
- $GLOBALS['_xmlrpcs_prev_ehandler'] = '';
- /**
- * Error handler used to track errors that occur during server-side execution of PHP code.
- * This allows to report back to the client whether an internal error has occurred or not
- * using an xmlrpc response object, instead of letting the client deal with the html junk
- * that a PHP execution error on the server generally entails.
- *
- * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
- *
- */
- function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
- {
- //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
- if($errcode != 2048) // do not use E_STRICT by name, since on PHP 4 it will not be defined
- {
- $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";
- }
- // Try to avoid as much as possible disruption to the previous error handling
- // mechanism in place
- if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')
- {
- // The previous error handler was the default: all we should do is log error
- // to teh default error log (if level high enough)
- if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode))
- {
- error_log($errstring);
- }
- }
- else
- {
- // Pass control on to previous error handler, trying to avoid loops...
- if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
- {
- // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers
- if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))
- {
- $GLOBALS['_xmlrpcs_prev_ehandler'][0]->$GLOBALS['_xmlrpcs_prev_ehandler'][1]($errcode, $errstring, $filename, $lineno, $context);
- }
- else
- {
- $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
- }
- }
- }
- }
-
- $GLOBALS['_xmlrpc_debuginfo']='';
-
- /**
- * Add a string to the debug info that can be later seralized by the server
- * as part of the response message.
- * Note that for best compatbility, the debug string should be encoded using
- * the $GLOBALS['xmlrpc_internalencoding'] character set.
- * @param string $m
- * @access public
- */
- function xmlrpc_debugmsg($m)
- {
- $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";
- }
-
- class xmlrpc_server
- {
- /// array defining php functions exposed as xmlrpc methods by this server
- var $dmap=array();
- /**
- * Defines how functions in dmap will be invokde: either using an xmlrpc msg object
- * or plain php values.
- * valid strings are 'xmlrpcvals' or 'phpvals'
- */
- var $functions_parameters_type='xmlrpcvals';
- /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3
- var $debug = 1;
- /**
- * When set to true, it will enable HTTP compression of the response, in case
- * the client has declared its support for compression in the request.
- */
- var $compress_response = false;
- /**
- * List of http compression methods accepted by the server for requests.
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
- */
- var $accepted_compression = array();
- /// shall we serve calls to system.* methods?
- var $allow_system_funcs = true;
- /// list of charset encodings natively accepted for requests
- var $accepted_charset_encodings = array();
- /**
- * charset encoding to be used for response.
- * NB: if we can, we will convert the generated response from internal_encoding to the intended one.
- * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled),
- * null (leave unspecified in response, convert output stream to US_ASCII),
- * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert outpt stream if needed),
- * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway).
- * NB: pretty dangerous if you accept every charset and do not have mbstring enabled)
- */
- var $response_charset_encoding = '';
- var $xml_header = "<?xml version=\"1.0\" ?>\n";
- /// storage for internal debug info
- var $debug_info = '';
-
- /**
- * @param array $dispmap the dispatch map withd efinition of exposed services
- * @param boolean $servicenow set to false to prevent the server from runnung upon construction
- */
- function xmlrpc_server($dispMap=null, $serviceNow=true)
- {
- // if ZLIB is enabled, let the server by default accept compressed requests,
- // and compress responses sent to clients that support them
- if(function_exists('gzinflate'))
- {
- $this->accepted_compression = array('gzip', 'deflate');
- $this->compress_response = true;
- }
-
- // by default the xml parser can support these 3 charset encodings
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
-
- // dispMap is a dispatch array of methods
- // mapped to function names and signatures
- // if a method
- // doesn't appear in the map then an unknown
- // method error is generated
- /* milosch - changed to make passing dispMap optional.
- * instead, you can use the class add_to_map() function
- * to add functions manually (borrowed from SOAPX4)
- */
- if($dispMap)
- {
- $this->dmap = $dispMap;
- if($serviceNow)
- {
- $this->service();
- }
- }
- }
-
- /**
- * Set debug level of server.
- * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments)
- * 0 = no debug info,
- * 1 = msgs set from user with debugmsg(),
- * 2 = add complete xmlrpc request (headers and body),
- * 3 = add also all processing warnings happened during method processing
- * (NB: this involves setting a custom error handler, and might interfere
- * with the standard processing of the php function exposed as method. In
- * particular, triggering an USER_ERROR level error will not halt script
- * execution anymore, but just end up logged in the xmlrpc response)
- * Note that info added at elevel 2 and 3 will be base64 encoded
- */
- function setDebug($in)
- {
- $this->debug=$in;
- }
-
- /**
- * Return a string with the serialized representation of all debug info
- * @param string $charset_encoding the target charset encoding for the serialization
- * @return string an XML comment (or two)
- */
- function serializeDebug($charset_encoding='')
- {
- // Tough encoding problem: which internal charset should we assume for debug info?
- // It might contain a copy of raw data received from client, ie with unknown encoding,
- // intermixed with php generated data and user generated data...
- // so we split it: system debug is base 64 encoded,
- // user debug info should be encoded by the end user using the INTERNAL_ENCODING
- $out = '';
- if ($this->debug_info != '') {
- $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
- }
- if($GLOBALS['_xmlrpc_debuginfo']!='')
- {
-
- $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
- // NB: a better solution MIGHT be to use CDATA, but we need to insert it
- // into return payload AFTER the beginning tag
- //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
- }
- return $out;
- }
-
- /**
- * Execute the xmlrpc request, printing the response
- * @param string $data the request body. If null, the http POST request will be examined
- */
- function service($data=null)
- {
- if ($data === null) {
- $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
- }
-
- // reset internal debug info
- $this->debug_info = '';
-
- // Echo back what we received, before parsing it
- if($this->debug > 1)
- {
- $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
- }
-
- $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding);
- if (!$r)
- {
- $r=$this->parseRequest($data, $req_charset);
- }
-
- if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors'])
- {
- $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
- $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++");
- }
-
- //$payload='<?xml version="1.0" encoding="' . $GLOBALS['xmlrpc_defencoding'] . '"?' . '>' . "\n"
- $payload=$this->xml_header;
- if($this->debug > 0)
- {
-
- //$payload = $payload . "<methodResponse>\n" . $this->serializeDebug();
- //$payload = $payload . substr($r->serialize(), 17);
- $payload = $payload . $this->serializeDebug($resp_charset);
- }
- //else
- //{
- $payload = $payload . $r->serialize($resp_charset);
- //}
-
-
- // if we get a warning/error that has output some text before here, then we cannot
- // add a new header. We cannot say we are sending xml, either...
- if(!headers_sent())
- {
- header('Content-Type: '.$r->content_type);
- // we do not know if client actually told us an accepted charset, but if he did
- // we have to tell him what we did
- header("Vary: Accept-Charset");
-
- // http compression of output
- if($this->compress_response && function_exists('gzencode') && $resp_encoding != '')
- {
- if(strstr($resp_encoding, 'gzip'))
- {
- $payload = gzencode($payload);
- header("Content-Encoding: gzip");
- header("Vary: Accept-Encoding");
- }
- elseif (strstr($resp_encoding, 'deflate'))
- {
- $payload = gzdeflate($payload);
- header("Content-Encoding: deflate");
- header("Vary: Accept-Encoding");
- }
- }
-
- header('Content-Length: ' . (int)strlen($payload));
- }
- else
- {
- //print "Internal server error: headers sent before PHP response"
- }
-
- print $payload;
- }
-
- /**
- * Add a method to the dispatch map
- * @param string $methodname the name with which the method will be made available
- * @param string $function the php function that will get invoked
- * @param array $sig the array of valid method signatures
- * @param string $doc method documentation
- */
- function add_to_map($methodname,$function,$sig,$doc='')
- {
- $this->dmap[$methodname] = array(
- 'function' => $function,
- 'signature' => $sig,
- 'docstring' => $doc
- );
- }
-
- /**
- * Verify type and number of parameters received against a list of known signatures
- * @param array $in array of either xmlrpcval objects or xmlrpc type definitions
- * @param array $sig array of known signatures to match against
- * @access private
- */
- function verifySignature($in, $sig)
- {
- // check each possible signature in turn
- if (is_object($in))
- {
- $numParams = $in->getNumParams();
- }
- else
- {
- $numParams = sizeof($in);
- }
- foreach($sig as $cursig)
- {
- if(sizeof($cursig)==$numParams+1)
- {
- $itsOK=1;
- for($n=0; $n<$numParams; $n++)
- {
- if (is_object($in))
- {
- $p=$in->getParam($n);
- if($p->kindOf() == 'scalar')
- {
- $pt=$p->scalartyp();
- }
- else
- {
- $pt=$p->kindOf();
- }
- }
- else
- {
- $pt= $in[$n] == 'i4' ? 'int' : $in[$n]; // dispatch maps never use i4...
- }
-
- // param index is $n+1, as first member of sig is return type
- if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue'])
- {
- $itsOK=0;
- $pno=$n+1;
- $wanted=$cursig[$n+1];
- $got=$pt;
- break;
- }
- }
- if($itsOK)
- {
- return array(1,'');
- }
- }
- }
- if(isset($wanted))
- {
- return array(0, "Wanted ${wanted}, got ${got} at param ${pno}");
- }
- else
- {
- return array(0, "No method signature matches number of parameters");
- }
- }
-
- /**
- * Parse http headers received along with xmlrpc request. If needed, inflate request
- * @return null on success or an xmlrpcresp
- * @access private
- */
- function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression)
- {
- // Play nice to PHP 4.0.x: superglobals were not yet invented...
- if(!isset($_SERVER))
- {
- $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
- }
-
- if($this->debug > 1)
- {
- if(function_exists('getallheaders'))
- {
- $this->debugmsg(''); // empty line
- foreach(getallheaders() as $name => $val)
- {
- $this->debugmsg("HEADER: $name: $val");
- }
- }
-
- }
-
- if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
- {
- $content_encoding = $_SERVER['HTTP_CONTENT_ENCODING'];
- }
- else
- {
- $content_encoding = '';
- }
-
- // check if request body has been compressed and decompress it
- if($content_encoding != '' && strlen($data))
- {
- if($content_encoding == 'deflate' || $content_encoding == 'gzip')
- {
- // if decoding works, use it. else assume data wasn't gzencoded
- if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression))
- {
- if($content_encoding == 'deflate' && $degzdata = @gzinflate($data))
- {
- $data = $degzdata;
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
- }
- }
- elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
- {
- $data = $degzdata;
- if($this->debug > 1)
- $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
- }
- else
- {
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
- return $r;
- }
- }
- else
- {
- //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
- return $r;
- }
- }
- }
-
- // check if client specified accepted charsets, and if we know how to fulfill
- // the request
- if ($this->response_charset_encoding == 'auto')
- {
- $resp_encoding = '';
- if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))
- {
- // here we should check if we can match the client-requested encoding
- // with the encodings we know we can generate.
- /// @todo we should parse q=0.x preferences instead of getting first charset specified...
- $client_accepted_charsets = split(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
- // Give preference to internal encoding
- $known_charsets = array($this->internal_encoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');
- foreach ($known_charsets as $charset)
- {
- foreach ($client_accepted_charsets as $accepted)
- if (strpos($accepted, $charset) === 0)
- {
- $resp_encoding = $charset;
- break;
- }
- if ($resp_encoding)
- break;
- }
- }
- }
- else
- {
-
- $resp_encoding = $this->response_charset_encoding;
- }
-
- if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
- {
- $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
- }
- else
- {
- $resp_compression = '';
- }
-
- // 'guestimate' request encoding
- /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check???
- $req_encoding = guess_encoding(isset($_SERVER['HTTP_CONTENT_TYPE']) ? $_SERVER['HTTP_CONTENT_TYPE'] : '',
- $data);
-
- return null;
- }
-
- /**
- * Parse an xml chunk containing an xmlrpc request and execute the corresponding
- * php function registered with the server
- * @param string $data the xml request
- * @param string $req_encoding (optional) the charset encoding of the xml request
- * @return xmlrpcresp
- * @access private
- */
- function parseRequest($data, $req_encoding='')
- {
- // 2005/05/07 commented and moved into caller function code
- //if($data=='')
- //{
- // $data=$GLOBALS['HTTP_RAW_POST_DATA'];
- //}
-
-
- // G. Giunta 2005/02/13: we do NOT expect to receive html entities
- // so we do not try to convert them into xml character entities
- //$data = xmlrpc_html_entity_xlate($data);
-
- $GLOBALS['_xh']=array();
- $GLOBALS['_xh']['isf']=0;
- $GLOBALS['_xh']['isf_reason']='';
- $GLOBALS['_xh']['params']=array();
- $GLOBALS['_xh']['pt']=array();
- $GLOBALS['_xh']['stack']=array();
- $GLOBALS['_xh']['valuestack'] = array();
- $GLOBALS['_xh']['method']='';
-
- // decompose incoming XML into request structure
- if ($req_encoding != '')
- {
- if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- // the following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
- //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- {
- error_log('XML-RPC: xmlrpc_server::parseRequest: invalid charset encoding of received request: '.$req_encoding);
- $req_encoding = $GLOBALS['xmlrpc_defencoding'];
- }
- $parser = xml_parser_create($req_encoding);
- }
- else
- {
- $parser = xml_parser_create();
- }
-
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
- // the xml parser to give us back data in the expected charset
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
-
- if ($this->functions_parameters_type == 'phpvals')
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
- else
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
- xml_set_character_data_handler($parser, 'xmlrpc_cd');
- xml_set_default_handler($parser, 'xmlrpc_dh');
- if(!xml_parse($parser, $data, 1))
- {
- // return XML error as a faultCode
- $r=&new xmlrpcresp(0,
- $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),
- sprintf('XML error: %s at line %d',
- xml_error_string(xml_get_error_code($parser)),
- xml_get_current_line_number($parser)));
- xml_parser_free($parser);
- }
- elseif ($GLOBALS['_xh']['isf'])
- {
- xml_parser_free($parser);
- $r=&new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['invalid_request'],
- $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
- }
- else
- {
- xml_parser_free($parser);
- if ($this->functions_parameters_type == 'phpvals')
- {
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
- }
- $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
- }
- else
- {
- // build an xmlrpcmsg object with data parsed from xml
- $m=&new xmlrpcmsg($GLOBALS['_xh']['method']);
- // now add parameters in
- for($i=0; $i<sizeof($GLOBALS['_xh']['params']); $i++)
- {
- $m->addParam($GLOBALS['_xh']['params'][$i]);
- }
-
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");
- }
-
- $r = $this->execute($m);
- }
- }
- return $r;
- }
-
- /**
- * Execute a method invoked by the client, checking parameters used
- * @param mixed $m either an xmlrpcmsg obj or a method name
- * @param array $params array with method parameters as php types (if m is method name only)
- * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only)
- * @return xmlrpcresp
- */
- function execute($m, $params=null, $paramtypes=null)
- {
- if (is_object($m))
- {
- $methName = $m->method();
- }
- else
- {
- $methName = $m;
- }
- $sysCall = $this->allow_system_funcs && ereg("^system\.", $methName);
- $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;
-
- if(!isset($dmap[$methName]['function']))
- {
- // No such method
- return new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['unknown_method'],
- $GLOBALS['xmlrpcstr']['unknown_method']);
- }
-
- // Check signature
- if(isset($dmap[$methName]['signature']))
- {
- $sig = $dmap[$methName]['signature'];
- if (is_object($m))
- {
- list($ok, $errstr) = $this->verifySignature($m, $sig);
- }
- else
- {
- list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
- }
- if(!$ok)
- {
- // Didn't match.
- return new xmlrpcresp(
- 0,
- $GLOBALS['xmlrpcerr']['incorrect_params'],
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
- );
- }
- }
-
- $func = $dmap[$methName]['function'];
- // let the 'class::function' syntax be accepted in dispatch maps
- if(is_string($func) && strpos($func, '::'))
- {
- $func = explode('::', $func);
- }
- // verify that function to be invoked is in fact callable
- if(!is_callable($func))
- {
- return new xmlrpcresp(
- 0,
- $GLOBALS['xmlrpcerr']['server_error'],
- $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"
- );
- }
-
- // If debug level is 3, we should catch all errors generated during
- // processing of user function, and log them as part of response
- if($this->debug > 2)
- {
- $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');
- }
- if (is_object($m))
- {
- if($sysCall)
- {
- $r = call_user_func($func, $this, $m);
- }
- else
- {
- $r = call_user_func($func, $m);
- }
- }
- else
- {
- // call a 'plain php' function
- if($sysCall)
- {
- array_unshift($params, $this);
- $r = call_user_func_array($func,$params);
- }
- else
- {
- $r = call_user_func_array($func, $params);
- }
- // the return type can be either an xmlrpcresp object or a plain php value...
- if (!is_a($r, 'xmlrpcresp'))
- {
- // what should we assume here about automatic encoding of datetimes
- // and php classes instances???
- $r = new xmlrpcresp(php_xmlrpc_encode($r, array('auto_dates')));
- }
- }
- if($this->debug > 2)
- {
- // note: restore the error handler we found before calling the
- // user func, even if it has been changed inside the func itself
- if($GLOBALS['_xmlrpcs_prev_ehandler'])
- {
- set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
- }
- else
- {
- restore_error_handler();
- }
- }
- return $r;
- }
-
- /**
- * add a string to the 'internal debug message' (separate from 'user debug message')
- * @param string $strings
- * @access private
- */
- function debugmsg($string)
- {
- $this->debug_info .= $string."\n";
- }
-
- /**
- * A debugging routine: just echoes back the input packet as a string value
- * DEPRECATED!
- */
- function echoInput()
- {
- $r=&new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
- print $r->serialize();
- }
- }
-?> \ No newline at end of file
diff --git a/addons/esale_joomla/esale_joomla.py b/addons/esale_joomla/esale_joomla.py
deleted file mode 100644
index 75d4d6f4a52..00000000000
--- a/addons/esale_joomla/esale_joomla.py
+++ /dev/null
@@ -1,293 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import netsvc
-from osv import fields,osv,orm
-import ir
-
-import time
-import xmlrpclib
-
-from mx import DateTime
-
-class esale_joomla_web(osv.osv):
- _name = "esale_joomla.web"
- _description = "eCommerce Website"
-
- _columns = {
- 'name': fields.char('Name',size=64, required=True),
- 'url': fields.char('URL', size=64, required=True),
- 'shop_id': fields.many2one('sale.shop', 'Sale Shop', required=True),
- 'active': fields.boolean('Active'),
- 'product_ids': fields.one2many('esale_joomla.product', 'web_id', string='Products'),
- 'tax_ids': fields.one2many('esale_joomla.tax', 'web_id', string='Taxes'),
- 'taxes_included_ids': fields.many2many('account.tax', 'esale_joomla_web_taxes_included_rel', 'esale_joomla_web_id', 'tax_id', 'Taxes included', domain=[('parent_id', '=', False)]),
- 'category_ids': fields.one2many('esale_joomla.category', 'web_id', string='Categories'),
- 'language_id' : fields.many2one('res.lang', 'Language'),
- }
- _defaults = {
- 'active': lambda *a: 1
- }
- def tax_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
- taxes = server.get_taxes()
- for tax in taxes:
- value={
- 'web_id' : website.id,
- 'esale_joomla_id' : tax[0],
- 'name' : tax[1]
- }
- self.pool.get('esale_joomla.tax').create(cr, uid, value)
- return True
-
- def lang_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
- languages = server.get_languages()
- for language in languages:
- value={
- 'web_id': website.id,
- 'esale_joomla_id': language[0],
- 'name': language[1]
- }
- self.pool.get('esale_joomla.lang').create(cr, uid, value)
- return True
-
- def category_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
- categories = server.get_categories()
- category_pool = self.pool.get('esale_joomla.category')
- for category in categories:
- value={
- 'web_id': website.id,
- 'esale_joomla_id': category[0],
- 'name': category[1]
- }
- existing = category_pool.search(cr, uid, [('web_id','=',website.id), ('esale_joomla_id', '=', category[0])])
- if len(existing)>0:
- category_pool.write(cr, uid, existing, value)
- else:
- category_pool.create(cr, uid, value)
- return True
-esale_joomla_web()
-
-class esale_joomla_tax(osv.osv):
- _name = "esale_joomla.tax"
- _description = "eSale Tax"
- _columns = {
- 'name' : fields.char('Tax name', size=32, required=True),
- 'esale_joomla_id' : fields.integer('eSale id'),
- 'tax_id' : fields.many2one('account.tax', 'Tax'),
- 'web_id' : fields.many2one('esale_joomla.web', 'Website')
- }
-esale_joomla_tax()
-
-class esale_joomla_category(osv.osv):
- _name = "esale_joomla.category"
- _description = "eSale Category"
- _columns = {
- 'name': fields.char('Name', size=64, required=True),
- 'esale_joomla_id': fields.integer('Web ID', readonly=True, required=True),
- 'web_id': fields.many2one('esale_joomla.web', 'Website'),
- 'category_id': fields.many2one('product.category', 'Category'),
- 'include_childs': fields.boolean('Include Childs', help="If checked, Tiny ERP will also export products from categories that are childs of this one."),
- }
-esale_joomla_category()
-
-class esale_joomla_product(osv.osv):
- _name = "esale_joomla.product"
- _description = "eSale Product"
- _columns = {
- 'web_id' : fields.many2one('esale_joomla.web', 'Web Ref'),
- 'name' : fields.char('Name', size=64, required=True),
- 'product_id' : fields.many2one('product.product', 'Product', required=True),
- 'esale_joomla_id' : fields.integer('eSale product id'),
- 'esale_joomla_tax_id' : fields.many2one('esale_joomla.tax', 'eSale tax'),
- }
-
- def onchange_product_id(self, cr, uid, ids, product_id, web_id=False):
- value={}
- if (product_id):
- product=self.pool.get('product.product').browse(cr, uid, product_id)
- value['name']=product.name
- return {'value': value}
-esale_joomla_product()
-
-class esale_joomla_language(osv.osv):
- _name = "esale_joomla.lang"
- _description = "eSale Language"
- _columns = {
- 'name' : fields.char('Name', size=32, required=True),
- 'esale_joomla_id' : fields.integer('Web ID', required=True),
- 'language_id' : fields.many2one('res.lang', 'Language'),
- 'web_id' : fields.many2one('esale_joomla.web', 'Website')
- }
-esale_joomla_language()
-
-class esale_joomla_partner(osv.osv):
- _name='esale_joomla.partner'
- _description = 'eShop Partner'
- _columns = {
- 'name': fields.char('Name',size=64, required=True),
- 'esale_id': fields.char('eSale ID', size=64),
- 'address': fields.char('Address',size=128),
- 'city': fields.char('City',size=64),
- 'zip': fields.char('Zip',size=64),
- 'country': fields.char('Country',size=64),
- 'email': fields.char('Mail',size=64),
- 'state': fields.char('State',size=64),
- 'address_id': fields.many2one('res.partner.address', 'Partner Address'),
- }
- def address_set(self, cr, uid, ids, context={}):
- for adr in self.browse(cr, uid, ids, context):
- if adr.address_id:
- continue
- country = self.pool.get('res.country').name_search(cr, uid, adr.country)
- state = self.pool.get('res.country.state').name_search(cr, uid, adr.state)
- create_id = self.pool.get('res.partner').create(cr, uid, {
- 'name': adr.name,
- })
- create_id2 = self.pool.get('res.partner.address').create(cr, uid, {
- 'street': adr.address,
- 'partner_id': create_id,
- 'zip': adr.zip,
- 'city': adr.city,
- 'email': adr.email,
- 'country_id': country and country[0][0] or False,
- 'state_id': state and state[0][0] or False,
- })
- self.write(cr, uid, [adr.id], {'address_id': create_id2} )
- return True
-esale_joomla_partner()
-
-class esale_joomla_order(osv.osv):
- _name='esale_joomla.order'
- _columns = {
- 'name': fields.char('Order Description',size=64, required=True),
- 'state': fields.selection([
- ('draft','Draft'),
- ('done','Done'),
- ('cancel','Cancel')
- ], 'Order State'),
- 'date_order':fields.date('Date Ordered', required=True),
-
- 'epartner_shipping_id':fields.many2one('esale_joomla.partner', 'Joomla Shipping Address', required=True),
- 'epartner_invoice_id':fields.many2one('esale_joomla.partner', 'Joomla Invoice Address', required=True),
-
- 'partner_id':fields.many2one('res.partner', 'Contact Address'),
- 'partner_shipping_id':fields.many2one('res.partner.address', 'Shipping Address'),
- 'partner_invoice_id':fields.many2one('res.partner.address', 'Invoice Address'),
-
- 'web_id':fields.many2one('esale_joomla.web', 'Web Shop', required=True),
- 'web_ref':fields.integer('Web Ref'),
-
- 'order_lines': fields.one2many('esale_joomla.order.line', 'order_id', 'Order Lines'),
- 'order_id': fields.many2one('sale.order', 'Sale Order'),
- 'note': fields.text('Notes'),
- }
- _defaults = {
- 'date_order': lambda *a: time.strftime('%Y-%m-%d'),
- 'state': lambda *a: 'draft',
- }
-
- def order_create(self, cr, uid, ids, context={}):
- for order in self.browse(cr, uid, ids, context):
- if not (order.partner_id and order.partner_invoice_id and order.partner_shipping_id):
- raise osv.except_osv('No addresses !', 'You must assign addresses before creating the order.')
- pricelist_id=order.partner_id.property_product_pricelist.id
- order_lines = []
- for line in order.order_lines:
- val = {
- 'name': line.name,
- 'product_uom_qty': line.product_qty,
- 'product_id': line.product_id.id,
- 'product_uom': line.product_uom_id.id,
- 'price_unit': line.price_unit,
- }
- val_new = self.pool.get('sale.order.line').product_id_change(cr, uid, None, pricelist_id, line.product_id.id, line.product_qty, line.product_uom_id.id, name=line.name)['value']
- del val_new['price_unit']
- del val_new['weight']
- val.update( val_new )
- val['tax_id'] = [(6,0,val['tax_id'])]
- order_lines.append( (0,0,val) )
- order_id = self.pool.get('sale.order').create(cr, uid, {
- 'name': order.name,
- 'shop_id': order.web_id.shop_id.id,
- 'origin': 'WEB:'+str(order.web_ref),
- 'user_id': uid,
- 'note': order.note or '',
- 'partner_id': order.partner_id.id,
- 'partner_invoice_id':order.partner_invoice_id.id,
- 'partner_order_id':order.partner_invoice_id.id,
- 'partner_shipping_id':order.partner_shipping_id.id,
- 'pricelist_id': pricelist_id,
- 'order_line': order_lines
- })
- self.write(cr, uid, [order.id], {'state':'done', 'order_id': order_id})
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'sale.order', order_id, 'order_confirm', cr)
- return True
-
- def address_set(self, cr, uid, ids, *args):
- done = []
- for order in self.browse(cr, uid, ids):
- for a in [order.epartner_shipping_id.id,order.epartner_invoice_id.id]:
- if a not in done:
- done.append(a)
- self.pool.get('esale_joomla.partner').address_set(cr, uid, [a] )
- self.write(cr, uid, [order.id], {
- 'partner_shipping_id': order.epartner_invoice_id.address_id.id,
- 'partner_id': order.epartner_invoice_id.address_id.partner_id.id,
- 'partner_invoice_id': order.epartner_shipping_id.address_id.id,
- })
- return True
-
- def order_cancel(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'cancel'})
- return True
-esale_joomla_order()
-
-class esale_joomla_order_line(osv.osv):
- _name = 'esale_joomla.order.line'
- _description = 'eSale Order line'
- _columns = {
- 'name': fields.char('Order Line', size=64, required=True),
- 'order_id': fields.many2one('esale_joomla.order', 'eOrder Ref'),
- 'product_qty': fields.float('Quantity', digits=(16,2), required=True),
- 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], change_default=True),
- 'product_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True),
- 'price_unit': fields.float('Unit Price', required=True),
- }
- _defaults = {
- }
-esale_joomla_order_line()
-
-
diff --git a/addons/esale_joomla/esale_joomla_view.xml b/addons/esale_joomla/esale_joomla_view.xml
deleted file mode 100644
index 6bc62fe3fef..00000000000
--- a/addons/esale_joomla/esale_joomla_view.xml
+++ /dev/null
@@ -1,204 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="ir.ui.view" id="view_esale_joomla_form">
- <field name="name">esale_joomla.web.form</field>
- <field name="model">esale_joomla.web</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale Web Shop">
- <notebook>
- <page string="General Informations">
- <separator string="Web Shop Info" colspan="4"/>
- <field name="name" select="1" colspan="3"/>
- <field name="url" widget="url" required="1"/>
- <field name="active" select="1"/>
- <field name="shop_id" select="1" required="1"/>
- <field name="language_id" select="1" required="1"/>
- <separator string="Configuration Instructions" colspan="4"/>
- <label string="After having completed the above data, proceed to the taxes, languages and categories mapping. Go to the next tabs, import data form the website and complete the third column." align="0.0" colspan="4"/>
- </page>
- <page string="Taxes Mapping">
- <button type="object" string="Initial Import of Taxes" colspan="4" name="tax_import"/>
- <separator string="Taxes" colspan="4"/>
- <field colspan="4" name="tax_ids" nolabel="1">
- <tree editable="bottom">
- <field name="name"/>
- <field name="esale_joomla_id" readonly="1"/>
- <field name="tax_id"/>
- </tree>
- </field>
- <separator string="Taxes included" colspan="4"/>
- <field colspan="4" name="taxes_included_ids" nolabel="1"/>
- </page>
- <page string="Categories Mapping">
- <button type="object" string="Synchronise products categories" colspan="4" name="category_import"/>
- <field colspan="4" name="category_ids" nolabel="1">
- <tree editable="bottom">
- <field name="name"/>
- <field name="esale_joomla_id" readonly="1"/>
- <field name="category_id"/>
- <field name="include_childs"/>
- </tree>
- </field>
- </page>
- </notebook>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_esale_joomla_tree">
- <field name="name">esale_joomla.web.tree</field>
- <field name="model">esale_joomla.web</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSale Web Shop">
- <field name="name"/>
- <field name="url"/>
- <field name="active"/>
- <field name="shop_id"/>
- <field name="language_id"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_esale_joomla_form">
- <field name="res_model">esale_joomla.web</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_esale_joomla_tree"/>
- </record>
- <menuitem name="Sales Management/Esale/Definition/Web Shop" id="menu_action_esale_joomla_web" action="action_esale_joomla_form" groups="admin"/>
-
- <record model="ir.ui.view" id="view_esale_joomla_product_form">
- <field name="name">esale_joomla.product.form</field>
- <field name="model">esale_joomla.product</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale product">
- <field name="name" select="1"/>
- <field name="esale_joomla_id" select="1"/>
- <field name="product_id" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_esale_joomla_product_tree">
- <field name="name">esale_joomla.product.tree</field>
- <field name="model">esale_joomla.product</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSale product">
- <field name="name" select="1"/>
- <field name="esale_joomla_id" select="1"/>
- <field name="product_id" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_esale_joomla_product_form">
- <field name="res_model">esale_joomla.product</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="view_id" ref="view_esale_joomla_product_tree"/>
- </record>
- <menuitem name="Sales Management/Esale/Definition/Web Product" id="menu_action_esale_joomla_product" action="action_esale_joomla_product_form" groups="admin"/>
-
- <record model="ir.ui.view" id="view_order_tree">
- <field name="name">esale_joomla.order.tree</field>
- <field name="model">esale_joomla.order</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Sales Orders">
- <field name="name"/>
- <field name="date_order"/>
- <field name="epartner_invoice_id"/>
- <field name="partner_id"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_order_form">
- <field name="name">esale_joomla.order.form</field>
- <field name="model">esale_joomla.order</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSale Order">
- <notebook>
- <page string="Order Line">
- <field name="name" select="1"/>
- <field name="date_order" select="1"/>
- <field name="epartner_invoice_id" select="2"/>
- <field name="epartner_shipping_id" select="2"/>
- <field name="partner_invoice_id"/>
- <field name="partner_shipping_id"/>
- <field name="partner_id" select="1"/>
- <button string="Create Addresses" colspan="2" type="object" name="address_set"/>
- <field name="web_ref" select="2"/>
- <field name="web_id" select="2"/>
- <field name="order_lines" widget="one2many_list" colspan="4" nolabel="1"/>
- <separator string="States" colspan="4"/>
- <field name="state"/>
- <button type="object" name="order_create" states="draft" string="Create Order"/>
- <button type="object" name="order_cancel" states="draft" string="Cancel Order"/>
- </page>
- <page string="Others data">
- <field name="order_id" colspan="3"/>
- <field name="note" colspan="3"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_order_form">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale_joomla.order</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_order_tree"/>
- </record>
- <menuitem name="Sales Management/Esale/Esale Orders" id="menu_action_order_form" action="action_order_form" groups="admin"/>
-
- <record model="ir.actions.act_window" id="action_order_tree">
- <field name="name">Draft eSale Order</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale_joomla.order</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','draft')]</field>
- </record>
- <menuitem name="Sales Management/Esale/Esale Orders/Draft Esale Orders" id="menu_action_order_tree" action="action_order_tree" groups="admin"/>
-
-
- <record model="ir.ui.view" id="view_order_line_form">
- <field name="name">esale_joomla.order.line.form</field>
- <field name="model">esale_joomla.order.line</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="eSales Order Line">
- <field name="name" colspan="3"/>
- <field name="product_id" colspan="3"/>
- <field name="product_qty"/>
- <field name="product_uom_id"/>
- <field name="price_unit"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_order_line_tree">
- <field name="name">esale_joomla.order.line.tree</field>
- <field name="model">esale_joomla.order.line</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="eSales Order Line">
- <field name="name"/>
- <field name="product_id"/>
- <field name="product_qty"/>
- <field name="product_uom_id"/>
- <field name="price_unit"/>
- </tree>
- </field>
- </record>
-
-
-</data>
-</terp>
diff --git a/addons/esale_joomla/esale_joomla_wizard.xml b/addons/esale_joomla/esale_joomla_wizard.xml
deleted file mode 100644
index b34232034c5..00000000000
--- a/addons/esale_joomla/esale_joomla_wizard.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <wizard
- string="Export products"
- model="esale_joomla.web"
- name="esale_joomla.products"
- menu="False"
- id="wizard_esale_joomla_products"/>
-
- <menuitem
- name="Sales Management/Esale/Synchronisation/Export Products"
- action="wizard_esale_joomla_products"
- type="wizard"
- id="menu_esale_joomla_products"/>
-
- <wizard
- string="Update stocks"
- model="esale_joomla.web"
- name="esale_joomla.stocks"
- menu="False"
- id="wizard_esale_joomla_stocks"/>
- <menuitem
- name="Sales Management/Esale/Synchronisation/Export Inventory Level"
- action="wizard_esale_joomla_stocks"
- type="wizard"
- id="menu_wizard_esale_joomla_stocks"/>
-
- <wizard
- string="Import sale orders"
- model="esale_joomla.web"
- name="esale_joomla.saleorders"
- menu="False"
- id="wizard_esale_joomla_saleorders"/>
- <menuitem
- name="Sales Management/Esale/Synchronisation/Import Esales Orders"
- action="wizard_esale_joomla_saleorders"
- type="wizard"
- id="menu_esale_joomla_saleorders"/>
-
- </data>
-</terp>
-
diff --git a/addons/esale_joomla/esale_joomla_workflow.xml b/addons/esale_joomla/esale_joomla_workflow.xml
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/esale_joomla/esale_joomla_workflow.xml
+++ /dev/null
diff --git a/addons/esale_joomla/wizard/__init__.py b/addons/esale_joomla/wizard/__init__.py
deleted file mode 100644
index ba85f74995a..00000000000
--- a/addons/esale_joomla/wizard/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import wizard_product_export
-import wizard_esale_import
-import wizard_product_stock
diff --git a/addons/esale_joomla/wizard/wizard_esale_import.py b/addons/esale_joomla/wizard/wizard_esale_import.py
deleted file mode 100644
index 09c2cc9a6e4..00000000000
--- a/addons/esale_joomla/wizard/wizard_esale_import.py
+++ /dev/null
@@ -1,105 +0,0 @@
-import netsvc
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import pooler
-
-import wizard
-from osv import osv
-
-_import_done_fields = {
- 'num': {'string':'New Sales Orders', 'readonly':True, 'type':'integer'}
-}
-
-_import_done_form = '''<?xml version="1.0"?>
-<form string="Saleorders import">
- <separator string="eSale Orders imported" colspan="4" />
- <field name="num"/>
-</form>'''
-
-def _do_import(self, cr, uid, data, context):
- self.pool = pooler.get_pool(cr.dbname)
- ids = self.pool.get('esale_joomla.web').search(cr, uid, [])
- total = 0
- for website in self.pool.get('esale_joomla.web').browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
-
- cr.execute("select max(web_ref) from esale_joomla_order where web_id=%d", (website.id,))
- max_web_id=cr.fetchone()[0]
-
- saleorders = server.get_saleorders(max_web_id or 0)
- for so in saleorders:
- total += 1
- pids = self.pool.get('esale_joomla.partner').search(cr, uid, [('esale_id','=',so['delivery']['esale_id'])])
- if pids:
- adr_ship = pids[0]
- self.pool.get('esale_joomla.partner').write(cr, uid, pids, so['delivery'] )
- else:
- adr_ship = self.pool.get('esale_joomla.partner').create(cr, uid, so['delivery'] )
-
- pids = self.pool.get('esale_joomla.partner').search(cr, uid, [('esale_id','=',so['billing']['esale_id'])])
- if pids:
- adr_bill = pids[0]
- self.pool.get('esale_joomla.partner').write(cr, uid, pids, so['billing'] )
- else:
- adr_bill = self.pool.get('esale_joomla.partner').create(cr, uid, so['billing'] )
-
- order_id=self.pool.get('esale_joomla.order').create(cr, uid, {
- 'web_id': website.id,
- 'web_ref': so['id'],
- 'name': so['id'],
- 'date_order': so['date'] or time.strftime('%Y-%m-%d'),
- 'note': so['note'] or '',
- 'epartner_shipping_id': adr_ship,
- 'epartner_invoice_id': adr_bill,
- })
-
- for orderline in so['lines']:
- ids=self.pool.get('esale_joomla.product').search(cr, uid, [('esale_joomla_id', '=', orderline['product_id']), ('web_id', '=', website.id)])
-
- if ids:
- osc_product_id=ids[0]
- osc_product=self.pool.get('esale_joomla.product').browse(cr, uid, osc_product_id)
- price=orderline['price']
- taxes_included=[]
- for taxe in osc_product.product_id.taxes_id:
- for t in website.taxes_included_ids:
- if t.id == taxe.id:
- taxes_included.append(taxe)
- for c in self.pool.get('account.tax').compute_inv(cr, uid, taxes_included, price, 1, product=osc_product.product_id):
- price-=c['amount']
-
- a = {
- 'product_id': osc_product.product_id.id,
- 'product_qty': orderline['product_qty'],
- 'name': osc_product.name,
- 'order_id': order_id,
- 'product_uom_id': osc_product.product_id.uom_id.id,
- 'price_unit': price,
- }
- self.pool.get('esale_joomla.order.line').create(cr, uid, {
- 'product_id': osc_product.product_id.id,
- 'product_qty': orderline['product_qty'],
- 'name': osc_product.name,
- 'order_id': order_id,
- 'product_uom_id': osc_product.product_id.uom_id.id,
- 'price_unit': price,
- })
- cr.commit()
- return {'num':total}
-
-class wiz_esale_joomla_import_sos(wizard.interface):
- states = {
- 'init': {
- 'actions': [_do_import],
- 'result': {
- 'type': 'form',
- 'arch': _import_done_form,
- 'fields': _import_done_fields,
- 'state': [('end', 'End')]
- }
- }
- }
-wiz_esale_joomla_import_sos('esale_joomla.saleorders');
diff --git a/addons/esale_joomla/wizard/wizard_product_export.py b/addons/esale_joomla/wizard/wizard_product_export.py
deleted file mode 100644
index e5f772e6a31..00000000000
--- a/addons/esale_joomla/wizard/wizard_product_export.py
+++ /dev/null
@@ -1,179 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import netsvc
-import pooler
-import urllib
-import base64
-
-import wizard
-from osv import osv
-
-_export_done_form = '''<?xml version="1.0"?>
-<form string="Initial import">
- <separator string="Products exported" colspan="4" />
- <field name="prod_new"/>
- <newline/>
- <field name="prod_update"/>
-</form>'''
-
-_export_done_fields = {
- 'prod_new': {'string':'New products', 'type':'float', 'readonly': True},
- 'prod_update': {'string':'Updated products', 'type':'float', 'readonly': True},
-}
-
-def _product_id_to_joomla_id(cr,uid,pool,product,website):
- esale_joomla_id2 = pool.get('esale_joomla.product').search(cr, uid, [('web_id','=',website.id),('product_id','=',product.id)])
- esale_joomla_id = 0
- if esale_joomla_id2:
- esale_joomla_id = pool.get('esale_joomla.product').read(cr, uid, [esale_joomla_id2[0]],["esale_joomla_id"])[0]["esale_joomla_id"]
- return esale_joomla_id
-
-def _do_export(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- ids = pool.get('esale_joomla.web').search(cr, uid, [])
- prod_new = 0
- prod_update = 0
- for website in pool.get('esale_joomla.web').browse(cr, uid, ids):
-
- pricelist = website.shop_id.pricelist_id.id
- if not pricelist:
- raise wizard.except_wizard('UserError', 'You must define a pricelist in your shop !')
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
- context['lang']=website.language_id.code
- categ_processed = []
-
- ## delete book if necessary :
- cr.execute("select jp.id, esale_joomla_id from esale_joomla_product jp inner join product_template pt on pt.id = jp.product_id where pt.categ_id not in (select category_id from esale_joomla_category) ")
- esale_ids= []
- joomla_ids= []
- for res in cr.fetchall():
- esale_ids.append(res[0])
- joomla_ids.append(res[1])
- if joomla_ids : server.unpublish_product(joomla_ids)
- pool.get('esale_joomla.product').unlink(cr,uid,esale_ids)
-
- for categ in website.category_ids:
- if not categ.category_id: continue
- ## for product already uploaded via another category we
- ## just update the current category :
- if categ.category_id.id in categ_processed :
- prod_ids = pool.get('product.product').search(cr, uid, [('categ_id','in',cat_ids)])
- product_ids = []
- for product in pool.get('product.product').browse(cr, uid, prod_ids, context=context):
- product_ids.append( _product_id_to_joomla_id(cr,uid,pool,product,website))
- server.set_product_category(categ.esale_joomla_id ,product_ids)
- continue
-
- cat_ids = [categ.category_id.id]
- if categ.include_childs:
- def _add_child(cat_ids, categ):
- for child in categ.child_id:
- if child.id not in cat_ids:
- cat_ids.append(child.id)
- _add_child(cat_ids, child)
- _add_child(cat_ids, categ.category_id)
- categ_processed.extend(cat_ids)
-
- prod_ids = pool.get('product.product').search(cr, uid, [('categ_id','in',cat_ids)])
- for product in pool.get('product.product').browse(cr, uid, prod_ids, context=context):
-
- esale_joomla_id= _product_id_to_joomla_id(cr,uid,pool,product,website)
-
- price = pool.get('product.pricelist').price_get(cr, uid, [pricelist], product.id, 1, 'list')[pricelist]
-
- taxes_included=[]
- taxes_name=[]
- for taxe in product.taxes_id:
- for t in website.taxes_included_ids:
- if t.id == taxe.id:
- taxes_included.append(taxe)
- for c in pool.get('account.tax').compute(cr, uid, taxes_included, price, 1): # DELETED product = product
- price+=c['amount']
- taxes_name.append(c['name'])
-
- tax_class_id = 1
- webproduct={
- 'esale_joomla_id': esale_joomla_id,
- 'quantity': pool.get('product.product')._product_virtual_available(cr, uid, [product.id], '', False, {'shop':website.shop_id.id})[product.id],
- 'model': product.code or '',
- 'price': price,
- 'weight': float(0.0),
- 'length': float(0.0),
- 'width': float(0.0),
- 'height': float(0.0),
- 'tax_class_id': tax_class_id,
- 'category_id': categ.esale_joomla_id,
- }
-
-
- attach_ids = pool.get('ir.attachment').search(cr, uid, [('res_model','=','product.product'), ('res_id', '=',product.id)])
- data = pool.get('ir.attachment').read(cr, uid, attach_ids)
- if len(data):
- webproduct['haspic'] = 1
- if not data[0]['link']:
- webproduct['picture'] = data[0]['datas']
- else:
- try:
- webproduct['picture'] = base64.encodestring(urllib.urlopen(data[0]['link']).read())
- except:
- webproduct['haspic'] = 0
- webproduct['fname'] = data[0]['datas_fname']
- else:
- webproduct['haspic'] =0
-
- webproduct['name'] = str(product.name or '')
- webproduct['description'] = str((product.description_sale or '') + (len(taxes_name) and ("\n(" + (', '.join(taxes_name)) + ')') or ''))
- webproduct['short_description'] = str(product.description_sale or '')
-
- osc_id=server.set_product(webproduct)
-
- if osc_id!=esale_joomla_id:
- if esale_joomla_id:
- pool.get('esale_joomla.product').write(cr, uid, [esale_joomla_id], {'esale_joomla_id': osc_id})
- prod_update += 1
- else:
- pool.get('esale_joomla.product').create(cr, uid, {'product_id': product.id, 'web_id': website.id, 'esale_joomla_id': osc_id, 'name': product.name })
- prod_new += 1
- else:
- prod_update += 1
- return {'prod_new':prod_new, 'prod_update':prod_update}
-
-class wiz_esale_joomla_products(wizard.interface):
- states = {
- 'init': {
- 'actions': [_do_export],
- 'result': {'type': 'form', 'arch': _export_done_form, 'fields': _export_done_fields, 'state': [('end', 'End')] }
- }
- }
-wiz_esale_joomla_products('esale_joomla.products');
-
diff --git a/addons/esale_joomla/wizard/wizard_product_stock.py b/addons/esale_joomla/wizard/wizard_product_stock.py
deleted file mode 100644
index 419d9a2edcd..00000000000
--- a/addons/esale_joomla/wizard/wizard_product_stock.py
+++ /dev/null
@@ -1,76 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import pooler
-
-import wizard
-from osv import osv
-
-_export_form = '''<?xml version="1.0"?>
-<form string="Initial import" />
-'''
-
-_export_fields = {}
-
-_export_done_form = '''<?xml version="1.0"?>
-<form string="Initial import">
-<separator string="Stock succesfully updated" colspan="4" />
-</form>'''
-
-_export_done_fields = {}
-
-def _do_export(self, cr, uid, data, context):
- self.pool = pooler.get_pool(cr.dbname)
- ids = self.pool.get('esale_joomla.web').search(cr, uid, [])
- for website in self.pool.get('esale_joomla.web').browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-synchro.php" % website.url)
- for osc_product in website.product_ids:
- if osc_product.esale_joomla_id:
- webproduct={
- 'esale_joomla_id': osc_product.esale_joomla_id,
- 'quantity': pooler.get_pool(cr.dbname).get('product.product')._product_virtual_available(cr, uid, [osc_product.product_id.id], '', False, {'shop':website.shop_id.id})[osc_product.product_id.id],
- }
- osc_id=server.set_product_stock(webproduct)
- return {}
-
-class wiz_esale_joomla_stocks(wizard.interface):
-
- states = {
- 'init': {
- 'actions': [_do_export],
- 'result': { 'type': 'form', 'arch': _export_done_form, 'fields': _export_done_fields, 'state': [('end', 'End')]}
- }
- }
-
-
-wiz_esale_joomla_stocks('esale_joomla.stocks');
diff --git a/addons/esale_osc/__init__.py b/addons/esale_osc/__init__.py
deleted file mode 100644
index c2bbc8345dd..00000000000
--- a/addons/esale_osc/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from esale_osc import *
-import wizard
diff --git a/addons/esale_osc/__terp__.py b/addons/esale_osc/__terp__.py
deleted file mode 100644
index 29a13daa98e..00000000000
--- a/addons/esale_osc/__terp__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "OScommerce Interface / ZenCart",
- "version" : "1.0",
- "author" : "Tiny / modified by Lucien Moerkamp",
- "category" : "Interfaces/CMS & eCommerce",
- "website" : "http://www.tinyerp.com",
- "depends" : ["product", "stock", "sale"],
- "description": """OSCommerce (Zencart) eCommerce interface synchronisation.
-Users can order on the website, orders are automatically imported in Tiny
-ERP.
-
-You can export products, stock level and create links between
-categories of products, taxes and languages.
-
-If you product has an image attched, it send the image to the Joomla website.""",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["esale_osc_view.xml", "esale_osc_wizard.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/esale_osc/connector/oscommerce/tinyerp-syncro.php b/addons/esale_osc/connector/oscommerce/tinyerp-syncro.php
deleted file mode 100644
index b7edb79dfef..00000000000
--- a/addons/esale_osc/connector/oscommerce/tinyerp-syncro.php
+++ /dev/null
@@ -1,253 +0,0 @@
-<?php
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////// ////////////////////
-/////////////////////// PLEASE CONFIGURE THE RIGHT INCLUDES FOR YOUR CONFIGURATION ////////////////////
-
- include("xmlrpcutils/xmlrpc.inc");
- include("xmlrpcutils/xmlrpcs.inc");
- include("../includes/configure.php");
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- $con = mysql_pconnect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
- mysql_select_db(DB_DATABASE);
-
- function get_taxes() {
- $taxes=array();
-
- $result=mysql_query("select tax_class_id, tax_class_title from tax_class;");
- if ($result) while ($row=mysql_fetch_row($result)) {
- $taxes[]=new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval($row[1], "string")), "array");
- }
- return new xmlrpcresp( new xmlrpcval($taxes, "array"));
- }
-
- function get_languages() {
- $languages=array();
-
- $result=mysql_query("select languages_id, name from languages;");
- if ($result) while ($row=mysql_fetch_row($result)) {
- $languages[]=new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval($row[1], "string")), "array");
- }
- return new xmlrpcresp( new xmlrpcval($languages, "array"));
- }
-
- function get_categories() {
- $categories=array();
-
- $result=mysql_query("select categories_id, min(language_id) from categories_description group by categories_id;");
- if ($result) while ($row=mysql_fetch_row($result)) {
- $resultb=mysql_query("select categories_id, categories_name from categories_description where categories_id=".$row[0]." and language_id=".$row[1].";");
- if ($resultb and $row=mysql_fetch_row($resultb)) {
- $categories[]=new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval(parent_category($row[0],$row[1]), "string")), "array");
- }
- }
- return new xmlrpcresp( new xmlrpcval($categories, "array"));
- }
-
- function parent_category($id, $name) {
- $result=mysql_query("select parent_id from categories where categories_id=".$id.";");
- if ($result && $row=mysql_fetch_row($result)) {
- if ($row[0]==0) {
- return $name;
- } else {
- $resultb=mysql_query("select min(language_id) from categories_description where categories_id=".$row[0].";");
- if ($resultb && $rowb=mysql_fetch_row($resultb)) {
- $resultb=mysql_query("select categories_name from categories_description where categories_id=".$row[0]." and language_id=".$rowb[0].";\n");
- if ($resultb && $rowb=mysql_fetch_row($resultb)) {
- $name=parent_category($row[0], $rowb[0] . " \\ ". $name);
- return $name;
- }
- }
- }
- }
- return $name;
- }
-
- function set_product_stock($tiny_product){
- mysql_query("update products set products_quantity=".$tiny_product['quantity']." where products_id=".$tiny_product['product_id'].";");
- mysql_query("update products set products_status=".(($tiny_product['quantity']>0)?1:0)." where products_id=".$tiny_product['product_id'].";");
- return new xmlrpcresp(new xmlrpcval(0,"int"));
- }
-
- function set_product($tiny_product){
- $lang_id=1;
- $id_exist=0;
- ////////Check for existance of product_id ///////////
- $result =mysql_query("select products_id from products where (products_id=".$tiny_product['product_id'].");");
- if ($result && $row=mysql_fetch_row($result)) {
- $id_exist=1;
- }
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//////////////// CHECK FOR oscommerce if "DEFAULT_LANGUAGE" must not be "DEFAULT LANGUAGE" ///////////////////////////////
-/////////////// //////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- $result =mysql_query("select l.languages_id from languages as l configuration as c where
- c.configuration_key='DEFAULT_LANGUAGE' and c.configuration_value=l.code;");
-
- if ($result && $row=mysql_fetch_row($result)) {
- $lang_id=$row[0];
- }
- if ($tiny_product['quantity']>0) {
- $tiny_product['status']=1;
- } else {
- $tiny_product['status']=0;
- }
- if ($id_exist==0) {
- mysql_query("insert into products (products_quantity, products_model, products_price, products_weight, products_tax_class_id, products_status, products_date_added) values (".$tiny_product['quantity'].", '". $tiny_product['model']."', ".$tiny_product['price'].", ".$tiny_product['weight'].", ".$tiny_product['tax_class_id'].", ".$tiny_product['status'].", now());");
- $osc_id=mysql_insert_id();
- mysql_query("insert into products_description (products_id, language_id, products_name, products_description) values (".$osc_id.", ".$lang_id.", '".$tiny_product['name']."', '".$tiny_product['description']."');");
- mysql_query("insert into products_to_categories (categories_id, products_id) values(".$tiny_product['category_id'].",".$osc_id.");");
- foreach ($tiny_product['langs'] as $lang=>$values) {
- mysql_query("insert into products_description(products_id, language_id, products_name, products_description)
- values (".$osc_id.", ".$lang.", '".$values['name']."', '".$values['description']."');");
- }
- } else {
- $osc_id=$tiny_product['product_id'];
- foreach (array('quantity', 'price', 'weight', 'tax_class_id', 'status') as $key) {
- mysql_query("update products set products_".$key."=".$tiny_product[$key]." where products_id=".$osc_id.";");
- }
- mysql_query("update products set products_model='".$tiny_product['model']."' where products_id=".$osc_id.";");
- foreach (array('name', 'description') as $key) {
- mysql_query("update products_description set products_".$key."='".$tiny_product[$key]."' where products_id=".$osc_id." and language_id=".$lang_id.";");
- }
- mysql_query("update products_to_categories set categories_id=".$tiny_product['category_id']." where products_id=".$osc_id.";");
- foreach ($tiny_product['langs'] as $lang=>$values) {
- mysql_query("delete from products_description where products_id=".$osc_id." and language_id=".$lang.";");
- mysql_query("insert into products_description(products_id, language_id, products_name, products_description)
- values (".$osc_id.", ".$lang.", '".$values['name']."', '".$values['description']."');");
- }
- }
-
- $cpt=0;
- if ($tiny_product['haspic']==1) {
- if (file_exists('../../images/'.$cpt.'-'.$tiny_product['fname'])) {
- unlink('../../images/'.$cpt.'-'.$tiny_product['fname']); // DELETE THE EXISTING IMAGES
- }
- if ($hd=fopen('../../images/'.$cpt.'-'.$tiny_product['fname'], "w")){
- fwrite($hd, base64_decode($tiny_product['picture']));
- fclose($hd);
- mysql_query("update products set products_image='".$cpt."-".$tiny_product['fname']."' where
- products_id=".$osc_id.";");
-
- }
- }
- return new xmlrpcresp(new xmlrpcval($osc_id, "int"));
- }
-
- function get_saleorders($last_so) {
- $saleorders=array();
- $result=mysql_query("SELECT `orders_id` , `customers_name` , `customers_street_address` , `customers_city` , `customers_postcode` , `customers_state` , `customers_country` , `customers_telephone` , `customers_email_address` , `delivery_name` , `delivery_street_address` , `delivery_city` , `delivery_postcode` , `delivery_state` , `delivery_country` , `billing_name` , `billing_street_address` , `billing_city` , `billing_postcode` , `billing_state` , `billing_country` , `date_purchased` , `orders_status`, `customers_id` FROM `orders` where (orders_id > ".$last_so." and orders_status = 1);");
-
- if ($result){
- while ($row=mysql_fetch_row($result)) {
- $orderlines=array();
- $resultb=mysql_query("select products_id, products_quantity, final_price from orders_products where orders_id=".$row[0].";");
- if ($resultb){
- while ($rowb=mysql_fetch_row($resultb)) {
- $orderlines[]=new xmlrpcval( array("product_id" => new xmlrpcval($rowb[0], "int"),
- "product_qty" => new xmlrpcval($rowb[1], "int"),
- "price" => new xmlrpcval($rowb[2], "int")
- ), "struct");
- }
- }
- $note="no note";
- $saleorders[] = new xmlrpcval( array("id" => new xmlrpcval( $row[0], "int"),
- "note" => new xmlrpcval( $note, "string" ),
- "lines" => new xmlrpcval( $orderlines, "array"),
- "address" => new xmlrpcval( array( "name" => new xmlrpcval($row[1], "string"),
- "address" => new xmlrpcval($row[2], "string"),
- "city" => new xmlrpcval($row[3], "string"),
- "zip" => new xmlrpcval($row[4], "string"),
- "state" => new xmlrpcval($row[5], "string"),
- "country" => new xmlrpcval($row[6], "string"),
- "phone" => new xmlrpcval($row[7], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[23], "string")
- ), "struct"),
- "delivery" => new xmlrpcval( array( "name" => new xmlrpcval($row[9], "string"),
- "address" => new xmlrpcval($row[10], "string"),
- "city" => new xmlrpcval($row[11], "string"),
- "zip" => new xmlrpcval($row[12], "string"),
- "state" => new xmlrpcval($row[13], "string"),
- "country" => new xmlrpcval($row[14], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[23], "string")
- ), "struct"),
- "billing" => new xmlrpcval( array( "name" => new xmlrpcval($row[15], "string"),
- "address" => new xmlrpcval($row[16], "string"),
- "city" => new xmlrpcval($row[17], "string"),
- "zip" => new xmlrpcval($row[18], "string"),
- "state" => new xmlrpcval($row[19], "string"),
- "country" => new xmlrpcval($row[20], "string"),
- "email" => new xmlrpcval($row[8], "string"),
- "esale_id" => new xmlrpcval($row[23], "string")
- ), "struct"),
- "date" => new xmlrpcval( $row[21], "string")
- ), "struct");
- }
- }
- return new xmlrpcresp(new xmlrpcval($saleorders, "array"));
- }
-
-
- function get_min_open_orders($last_so) {
- $result=mysql_query("SELECT min(`orders_id`) as min FROM `orders` where (orders_id <= ".$last_so.") and (orders_status = 2);");
- if ($result) {
- $min=mysql_fetch_row($result);
- return new xmlrpcresp( new xmlrpcval($min[0], "int"));
- }
- else return new xmlrpcresp( new xmlrpcval(-1, "int"));
- }
-
- function close_open_orders($order_id) {
- mysql_query("update orders set orders_status=3 where orders_id=".$order_id.";");
- return new xmlrpcresp(new xmlrpcval(0, "int"));
- }
-
-
- function process_order($order_id) {
- mysql_query("update orders set orders_status=2 where orders_id=".$order_id.";");
- return new xmlrpcresp(new xmlrpcval(0, "int"));
- }
-
- $server = new xmlrpc_server( array( "get_taxes" => array( "function" => "get_taxes",
- "signature" => array( array($xmlrpcArray)
- )
- ),
- "get_languages" => array( "function" => "get_languages",
- "signature" => array( array($xmlrpcArray)
- )
- ),
- "get_categories" => array( "function" => "get_categories",
- "signature" => array( array($xmlrpcArray)
- )
- ),
- "get_saleorders" => array( "function" => "get_saleorders",
- "signature" => array( array($xmlrpcArray, $xmlrpcInt)
- )
- ),
- "get_min_open_orders" => array( "function" => "get_min_open_orders",
- "signature" => array( array($xmlrpcInt, $xmlrpcInt)
- )
- ),
- "set_product" => array( "function" => "set_product",
- "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
- )
- ),
- "set_product_stock" => array( "function" => "set_product_stock",
- "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
- )
- ),
- "process_order" => array( "function" => "process_order",
- "signature" => array( array($xmlrpcInt, $xmlrpcInt)
- )
- ),
- "close_open_orders" => array( "function" => "close_open_orders",
- "signature" => array( array($xmlrpcInt, $xmlrpcInt)
- )
- )
- ), false);
- $server->functions_parameters_type= 'phpvals';
- $server->service();
-?>
diff --git a/addons/esale_osc/connector/xmlrpc.inc b/addons/esale_osc/connector/xmlrpc.inc
deleted file mode 100644
index d0043dc4eb1..00000000000
--- a/addons/esale_osc/connector/xmlrpc.inc
+++ /dev/null
@@ -1,3600 +0,0 @@
-<?php // -*-c++-*-
-// by Edd Dumbill (C) 1999-2002
-// <edd@usefulinc.com>
-// $Id: xmlrpc.inc,v 1.113 2006/01/22 23:55:57 ggiunta Exp $
-
-
-// Copyright (c) 1999,2000,2002 Edd Dumbill.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// * Neither the name of the "XML-RPC for PHP" nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
- if(!function_exists('xml_parser_create'))
- {
- // For PHP 4 onward, XML functionality is always compiled-in on windows:
- // no more need to dl-open it. It might have been compiled out on *nix...
- if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
- {
- dl('xml.so');
- }
- }
-
- // Try to be backward compat with php < 4.2 (are we not being nice ?)
- if(substr(phpversion(), 0, 3) == '4.0' || @version_compare(substr(phpversion(), 0, 3) == '4.1'))
- {
- // give an opportunity to user to specify where to include other files from
- if(!defined('PHP_XMLRPC_COMPAT_DIR'))
- {
- define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');
- }
- if(substr(phpversion(), 0, 3) == '4.0')
- {
- include(PHP_XMLRPC_COMPAT_DIR."is_scalar.php");
- include(PHP_XMLRPC_COMPAT_DIR."array_key_exists.php");
- include(PHP_XMLRPC_COMPAT_DIR."version_compare.php");
- }
- include(PHP_XMLRPC_COMPAT_DIR."var_export.php");
- include(PHP_XMLRPC_COMPAT_DIR."is_a.php");
- }
-
- // G. Giunta 2005/01/29: declare global these variables,
- // so that xmlrpc.inc will work even if included from within a function
- // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
- $GLOBALS['xmlrpcI4']='i4';
- $GLOBALS['xmlrpcInt']='int';
- $GLOBALS['xmlrpcBoolean']='boolean';
- $GLOBALS['xmlrpcDouble']='double';
- $GLOBALS['xmlrpcString']='string';
- $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
- $GLOBALS['xmlrpcBase64']='base64';
- $GLOBALS['xmlrpcArray']='array';
- $GLOBALS['xmlrpcStruct']='struct';
- $GLOBALS['xmlrpcValue']='undefined';
-
- $GLOBALS['xmlrpcTypes']=array(
- $GLOBALS['xmlrpcI4'] => 1,
- $GLOBALS['xmlrpcInt'] => 1,
- $GLOBALS['xmlrpcBoolean'] => 1,
- $GLOBALS['xmlrpcString'] => 1,
- $GLOBALS['xmlrpcDouble'] => 1,
- $GLOBALS['xmlrpcDateTime'] => 1,
- $GLOBALS['xmlrpcBase64'] => 1,
- $GLOBALS['xmlrpcArray'] => 2,
- $GLOBALS['xmlrpcStruct'] => 3
- );
-
- $GLOBALS['xmlrpc_valid_parents'] = array(
- 'BOOLEAN' => array('VALUE'),
- 'I4' => array('VALUE'),
- 'INT' => array('VALUE'),
- 'STRING' => array('VALUE'),
- 'DOUBLE' => array('VALUE'),
- 'DATETIME.ISO8601' => array('VALUE'),
- 'BASE64' => array('VALUE'),
- 'ARRAY' => array('VALUE'),
- 'STRUCT' => array('VALUE'),
- 'PARAM' => array('PARAMS'),
- 'METHODNAME' => array('METHODCALL'),
- 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
- 'MEMBER' => array('STRUCT'),
- 'NAME' => array('MEMBER'),
- 'DATA' => array('ARRAY'),
- 'FAULT' => array('METHODRESPONSE'),
- 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
- );
-
- $GLOBALS['xmlEntities']=array(
- 'amp' => '&',
- 'quot' => '"',
- 'lt' => '<',
- 'gt' => '>',
- 'apos' => "'"
- );
-
- // tables used for transcoding different charsets into us-ascii xml
-
- $GLOBALS['xml_iso88591_Entities']=array();
- $GLOBALS['xml_iso88591_Entities']['in'] = array();
- $GLOBALS['xml_iso88591_Entities']['out'] = array();
- for ($i = 0; $i < 32; $i++)
- {
-
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
- $GLOBALS['xml_iso88591_Entities']['out'][] = "&#$i;";
- }
- for ($i = 160; $i < 256; $i++)
- {
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
- $GLOBALS['xml_iso88591_Entities']['out'][] = "&#$i;";
- }
-
- /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159.
- /// These will NOT be present in true ISO-8859-1, but will save the unwary
- /// windows user from sending junk.
-/*
-$cp1252_to_htmlent =
- array(
- '\x80'=>'&#x20AC;', '\x81'=>'?', '\x82'=>'&#x201A;', '\x83'=>'&#x0192;',
- '\x84'=>'&#x201E;', '\x85'=>'&#x2026;', '\x86'=>'&#x2020;', \x87'=>'&#x2021;',
- '\x88'=>'&#x02C6;', '\x89'=>'&#x2030;', '\x8A'=>'&#x0160;', '\x8B'=>'&#x2039;',
- '\x8C'=>'&#x0152;', '\x8D'=>'?', '\x8E'=>'&#x017D;', '\x8F'=>'?',
- '\x90'=>'?', '\x91'=>'&#x2018;', '\x92'=>'&#x2019;', '\x93'=>'&#x201C;',
- '\x94'=>'&#x201D;', '\x95'=>'&#x2022;', '\x96'=>'&#x2013;', '\x97'=>'&#x2014;',
- '\x98'=>'&#x02DC;', '\x99'=>'&#x2122;', '\x9A'=>'&#x0161;', '\x9B'=>'&#x203A;',
- '\x9C'=>'&#x0153;', '\x9D'=>'?', '\x9E'=>'&#x017E;', '\x9F'=>'&#x0178;'
- );
-*/
-
- $GLOBALS['xmlrpcerr']['unknown_method']=1;
- $GLOBALS['xmlrpcstr']['unknown_method']='Unknown method';
- $GLOBALS['xmlrpcerr']['invalid_return']=2;
- $GLOBALS['xmlrpcstr']['invalid_return']='Invalid return payload: enable debugging to examine incoming payload';
- $GLOBALS['xmlrpcerr']['incorrect_params']=3;
- $GLOBALS['xmlrpcstr']['incorrect_params']='Incorrect parameters passed to method';
- $GLOBALS['xmlrpcerr']['introspect_unknown']=4;
- $GLOBALS['xmlrpcstr']['introspect_unknown']="Can't introspect: method unknown";
- $GLOBALS['xmlrpcerr']['http_error']=5;
- $GLOBALS['xmlrpcstr']['http_error']="Didn't receive 200 OK from remote server.";
- $GLOBALS['xmlrpcerr']['no_data']=6;
- $GLOBALS['xmlrpcstr']['no_data']='No data received from server.';
- $GLOBALS['xmlrpcerr']['no_ssl']=7;
- $GLOBALS['xmlrpcstr']['no_ssl']='No SSL support compiled in.';
- $GLOBALS['xmlrpcerr']['curl_fail']=8;
- $GLOBALS['xmlrpcstr']['curl_fail']='CURL error';
- $GLOBALS['xmlrpcerr']['invalid_request']=15;
- $GLOBALS['xmlrpcstr']['invalid_request']='Invalid request payload';
- $GLOBALS['xmlrpcerr']['no_curl']=16;
- $GLOBALS['xmlrpcstr']['no_curl']='No CURL support compiled in.';
- $GLOBALS['xmlrpcerr']['server_error']=17;
- $GLOBALS['xmlrpcstr']['server_error']='Internal server error';
- $GLOBALS['xmlrpcerr']['multicall_error']=18;
- $GLOBALS['xmlrpcstr']['multicall_error']='Received from server invalid multicall response';
-
- $GLOBALS['xmlrpcerr']['multicall_notstruct'] = 9;
- $GLOBALS['xmlrpcstr']['multicall_notstruct'] = 'system.multicall expected struct';
- $GLOBALS['xmlrpcerr']['multicall_nomethod'] = 10;
- $GLOBALS['xmlrpcstr']['multicall_nomethod'] = 'missing methodName';
- $GLOBALS['xmlrpcerr']['multicall_notstring'] = 11;
- $GLOBALS['xmlrpcstr']['multicall_notstring'] = 'methodName is not a string';
- $GLOBALS['xmlrpcerr']['multicall_recursion'] = 12;
- $GLOBALS['xmlrpcstr']['multicall_recursion'] = 'recursive system.multicall forbidden';
- $GLOBALS['xmlrpcerr']['multicall_noparams'] = 13;
- $GLOBALS['xmlrpcstr']['multicall_noparams'] = 'missing params';
- $GLOBALS['xmlrpcerr']['multicall_notarray'] = 14;
- $GLOBALS['xmlrpcstr']['multicall_notarray'] = 'params is not an array';
-
- $GLOBALS['xmlrpcerr']['cannot_decompress']=103;
- $GLOBALS['xmlrpcstr']['cannot_decompress']='Received from server compressed HTTP and cannot decompress';
- $GLOBALS['xmlrpcerr']['decompress_fail']=104;
- $GLOBALS['xmlrpcstr']['decompress_fail']='Received from server invalid compressed HTTP';
- $GLOBALS['xmlrpcerr']['dechunk_fail']=105;
- $GLOBALS['xmlrpcstr']['dechunk_fail']='Received from server invalid chunked HTTP';
- $GLOBALS['xmlrpcerr']['server_cannot_decompress']=106;
- $GLOBALS['xmlrpcstr']['server_cannot_decompress']='Received from client compressed HTTP request and cannot decompress';
- $GLOBALS['xmlrpcerr']['server_decompress_fail']=107;
- $GLOBALS['xmlrpcstr']['server_decompress_fail']='Received from client invalid compressed HTTP request';
-
- // The charset encoding used by the server for received messages and
- // by the client for received responses when received charset cannot be determined
- // or is not supported
- $GLOBALS['xmlrpc_defencoding']='UTF-8';
- // The encoding used internally by PHP.
- // String values received as xml will be converted to this, and php strings will be converted to xml
-
- // as if having been coded with this
- $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
-
- $GLOBALS['xmlrpcName']='XML-RPC for PHP';
- $GLOBALS['xmlrpcVersion']='2.0RC3';
-
- // let user errors start at 800
- $GLOBALS['xmlrpcerruser']=800;
- // let XML parse errors start at 100
- $GLOBALS['xmlrpcerrxml']=100;
-
- // formulate backslashes for escaping regexp
- $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
-
- // used to store state during parsing
- // quick explanation of components:
- // ac - used to accumulate values
- // isf - used to indicate a fault
- // lv - used to indicate "looking for a value": implements
- // the logic to allow values with no types to be strings
- // params - used to store parameters in method calls
- // method - used to store method name
- // stack - array with genealogy of xml elements names:
- // used to validate nesting of xmlrpc elements
-
- $GLOBALS['_xh']=null;
-
- /**
- * Convert a string to the correct XML representation in a target charset
- * To help correct communication of non-ascii chars inside strings, regardless
- * of the charset used when sending requests, parsing them, sending responses
- * and parsing responses, an option is to convert all non-ascii chars present in the message
- * into their equivalent 'charset entity'. Charset entities enumerated this way
- * are independent of the charset encoding used to transmit them, and all XML
- * parsers are bound to understand them.
- * Note that in the std case we are not sending a charset encoding mime type
- * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
- *
- * @todo do a bit of basic benchmarking (strtr vs. str_replace)
- * @todo make usage of iconv() or recode_string() or mb_string() where available
- */
- function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
- {
- if ($src_encoding == '')
- {
- // lame, but we know no better...
- $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
- }
- //if ($dest_encoding == '')
- //{
- // // lame, but we know no better...
- // $dest_encoding = 'US-ASCII';
- //}
- switch(strtoupper($src_encoding.'_'.$dest_encoding))
- {
- case 'ISO-8859-1_':
- case 'ISO-8859-1_US-ASCII':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
- break;
- case 'ISO-8859-1_UTF-8':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- $escaped_data = utf8_encode($escaped_data);
- break;
- case 'ISO-8859-1_ISO-8859-1':
- case 'US-ASCII_US-ASCII':
- case 'US-ASCII_UTF-8':
- case 'US-ASCII_':
- case 'US-ASCII_ISO-8859-1':
- case 'UTF-8_UTF-8':
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
- break;
- case 'UTF-8_':
- case 'UTF-8_US-ASCII':
- case 'UTF-8_ISO-8859-1':
- // NB: this will choke on invalid UTF-8, going most likely beyond EOF
- $escaped_data = "";
- // be kind to users creating string xmlrpcvals out of different php types
- $data = (string) $data;
- $ns = strlen ($data);
- for ($nn = 0; $nn < $ns; $nn++)
- {
- $ch = $data[$nn];
- $ii = ord($ch);
-//1 7 0bbbbbbb (127)
- if ($ii < 128)
- {
- /// @todo shall we replace this with a (suuposedly) faster str_replace?
- switch($ii){
- case 34:
- $escaped_data .= '&quot;';
- break;
- case 38:
- $escaped_data .= '&amp;';
- case 39:
- $escaped_data .= '&apos;';
- break;
- case 60:
- $escaped_data .= '&lt;';
- break;
- case 62:
- $escaped_data .= '&gt;';
- break;
- default:
- $escaped_data .= $ch;
- } // switch
- }
-//2 11 110bbbbb 10bbbbbb (2047)
- else if ($ii>>5 == 6)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ($b1 * 64) + $b2;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
-//3 16 1110bbbb 10bbbbbb 10bbbbbb
- else if ($ii>>4 == 14)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ord($data[$nn+2]);
- $b3 = ($ii & 63);
- $ii = ((($b1 * 64) + $b2) * 64) + $b3;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
-//4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- else if ($ii>>3 == 30)
- {
- $b1 = ($ii & 31);
- $ii = ord($data[$nn+1]);
- $b2 = ($ii & 63);
- $ii = ord($data[$nn+2]);
- $b3 = ($ii & 63);
- $ii = ord($data[$nn+3]);
- $b4 = ($ii & 63);
- $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
- $ent = sprintf ("&#%d;", $ii);
- $escaped_data .= $ent;
- }
- }
- break;
- default:
- $escaped_data = '';
- error_log("Converting from $src_encoding to $dest_encoding: not supported...");
- }
-// } // switch
- return $escaped_data;
- }
-
- function xmlrpc_se($parser, $name, $attrs)
- {
- // if invalid xmlrpc already detected, skip all processing
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- // check for correct element nesting
- // top level element can only be of 2 types
- if (count($GLOBALS['_xh']['stack']) == 0)
- {
- if ($name != 'METHODRESPONSE' && $name != 'METHODCALL')
- {
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
- return;
- }
- }
- else
- {
- // not top level element: see if parent is OK
- $parent = end($GLOBALS['_xh']['stack']);
- if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
- {
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
- return;
- }
- }
-
- switch($name)
- {
- case 'STRUCT':
- case 'ARRAY':
- // create an empty array to hold child values, and push it onto appropriate stack
- $cur_val = array();
- $cur_val['values'] = array();
- $cur_val['type'] = $name;
- // check for out-of-band information to rebuild php objs
- // and in case it is found, save it
- if (@isset($attrs['PHP_CLASS']))
- {
- $cur_val['php_class'] = $attrs['PHP_CLASS'];
- }
- $GLOBALS['_xh']['valuestack'][] = $cur_val;
- break;
- case 'DATA':
- case 'METHODCALL':
- case 'METHODRESPONSE':
- case 'PARAMS':
- // valid elements that add little to processing
- break;
- case 'METHODNAME':
- case 'NAME':
- $GLOBALS['_xh']['ac']='';
- break;
- case 'FAULT':
- $GLOBALS['_xh']['isf']=1;
- break;
- case 'VALUE':
- $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
- $GLOBALS['_xh']['ac']='';
- $GLOBALS['_xh']['lv']=1;
- $GLOBALS['_xh']['php_class']=null;
- break;
- case 'I4':
- case 'INT':
- case 'STRING':
- case 'BOOLEAN':
- case 'DOUBLE':
- case 'DATETIME.ISO8601':
- case 'BASE64':
- if ($GLOBALS['_xh']['vt']!='value')
- {
- //two data elements inside a value: an error occurred!
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
- return;
- }
-
- $GLOBALS['_xh']['ac']=''; // reset the accumulator
- break;
- case 'MEMBER':
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
- //$GLOBALS['_xh']['ac']='';
- // Drop trough intentionally
- case 'PARAM':
- // clear value type, so we can check later if no value has been passed for this param/member
- $GLOBALS['_xh']['vt']=null;
- break;
- default:
- /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
- $GLOBALS['_xh']['isf'] = 2;
- $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";
- break;
- }
-
- // Save current element name to stack, to validate nesting
- $GLOBALS['_xh']['stack'][] = $name;
-
- if($name!='VALUE')
- {
- $GLOBALS['_xh']['lv']=0;
- }
- }
- }
-
- function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
- {
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- // push this element name from stack
- // NB: if XML validates, correct opening/closing is guaranteed and
- // we do not have to check for $name == $curr_elem.
- // we also checked for proper nesting at start of elements...
- $curr_elem = array_pop($GLOBALS['_xh']['stack']);
-
- switch($name)
- {
- case 'STRUCT':
- case 'ARRAY':
- // fetch out of stack array of values, and promote it to current value
- $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
- $GLOBALS['_xh']['value'] = $curr_val['values'];
- $GLOBALS['_xh']['vt']=strtolower($name);
- if (isset($curr_val['php_class']))
- {
- $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
- }
- break;
- case 'NAME':
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
- break;
- case 'BOOLEAN':
- case 'I4':
- case 'INT':
- case 'STRING':
- case 'DOUBLE':
- case 'DATETIME.ISO8601':
- case 'BASE64':
- $GLOBALS['_xh']['vt']=strtolower($name);
- if ($name=='STRING')
- {
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- }
- elseif ($name=='DATETIME.ISO8601')
- {
- /// @todo validate datetime values with a correct format mask?
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- }
- elseif ($name=='BASE64')
- {
- /// @todo check for failure of base64 decoding / catch warnings
- $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
- }
- elseif ($name=='BOOLEAN')
- {
- // special case here: we translate boolean 1 or 0 into PHP
- // constants true or false
- // NB: this simple checks helps a lot sanitizing input, ie no
- // security problems around here
- if ($GLOBALS['_xh']['ac']=='1')
- {
- $GLOBALS['_xh']['value']=true;
- }
- else
- {
- // log if receiveing something strange, even though we set the value to false anyway
- if ($GLOBALS['_xh']['ac']!='0')
- error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']=false;
- }
- }
- elseif ($name=='DOUBLE')
- {
- // we have a DOUBLE
- // we must check that only 0123456789-.<space> are characters here
- if (!ereg("^[+-]?[eE0123456789 \\t.]+$", $GLOBALS['_xh']['ac']))
- {
- /// @todo: find a better way of throwing an error
- // than this!
- error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
- }
- else
- {
- // it's ok, add it on
- $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
- }
- }
- else
- {
- // we have an I4/INT
- // we must check that only 0123456789-<space> are characters here
- if (!ereg("^[+-]?[0123456789 \\t]+$", $GLOBALS['_xh']['ac']))
- {
- /// @todo find a better way of throwing an error
- // than this!
- error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
- }
- else
- {
- // it's ok, add it on
- $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
- }
- }
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- $GLOBALS['_xh']['lv']=3; // indicate we've found a value
- break;
- case 'VALUE':
- // This if() detects if no scalar was inside <VALUE></VALUE>
- if ($GLOBALS['_xh']['vt']=='value')
- {
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
- }
-
- if ($rebuild_xmlrpcvals)
- {
- // build the xmlrpc val out of the data received, and substitute it
- $temp =& new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
- // in case we got info about underlying php class, save it
- // in the object we're rebuilding
- if (isset($GLOBALS['_xh']['php_class']))
- $temp->_php_class = $GLOBALS['_xh']['php_class'];
- // check if we are inside an array or struct:
- // if value just built is inside an array, let's move it into array on the stack
- $vscount = count($GLOBALS['_xh']['valuestack']);
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
- {
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
- }
- else
- {
- $GLOBALS['_xh']['value'] = $temp;
- }
- }
- else
- {
- /// @todo this needs to treat correctly php-serialized objects,
- /// since std deserializing is done by php_xmlrpc_decode,
- /// which we will not be calling...
- if (isset($GLOBALS['_xh']['php_class']))
- {
- }
-
- // check if we are inside an array or struct:
- // if value just built is inside an array, let's move it into array on the stack
- $vscount = count($GLOBALS['_xh']['valuestack']);
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
- {
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
- }
- }
- break;
- case 'MEMBER':
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- // add to array in the stack the last element built,
- // unless no VALUE was found
- if ($GLOBALS['_xh']['vt'])
- {
- $vscount = count($GLOBALS['_xh']['valuestack']);
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
- } else
- error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
- break;
- case 'DATA':
- $GLOBALS['_xh']['ac']=''; // is this necessary?
- break;
- case 'PARAM':
- // add to array of params the current value,
- // unless no VALUE was found
- if ($GLOBALS['_xh']['vt'])
- {
- $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
- $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
- }
- else
- error_log('XML-RPC: missing VALUE inside PARAM in received xml');
- break;
- case 'METHODNAME':
- $GLOBALS['_xh']['method']=ereg_replace("^[\n\r\t ]+", '', $GLOBALS['_xh']['ac']);
- break;
- case 'PARAMS':
- case 'FAULT':
- case 'METHODCALL':
- case 'METHORESPONSE':
- break;
- default:
- // End of INVALID ELEMENT!
- // shall we add an assert here for unreachable code???
- break;
- }
- }
- }
-
- function xmlrpc_ee_fast($parser, $name)
- {
- xmlrpc_ee($parser, $name, false);
- }
-
- function xmlrpc_cd($parser, $data)
- {
- //if(ereg("^[\n\r \t]+$", $data)) return;
- // print "adding [${data}]\n";
-
- // skip processing if xml fault already detected
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- if($GLOBALS['_xh']['lv']!=3)
- {
- // "lookforvalue==3" means that we've found an entire value
- // and should discard any further character data
- if($GLOBALS['_xh']['lv']==1)
- {
- // if we've found text and we're just in a <value> then
- // say we've found a value
- $GLOBALS['_xh']['lv']=2;
- }
- if(!@isset($GLOBALS['_xh']['ac']))
- {
- $GLOBALS['_xh']['ac'] = '';
- }
- $GLOBALS['_xh']['ac'].=$data;
- }
- }
- }
-
- function xmlrpc_dh($parser, $data)
- {
- // skip processing if xml fault already detected
- if ($GLOBALS['_xh']['isf'] < 2)
- {
- if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
- {
- if($GLOBALS['_xh']['lv']==1)
- {
- $GLOBALS['_xh']['lv']=2;
- }
- $GLOBALS['_xh']['ac'].=$data;
- }
- }
- }
-
- class xmlrpc_client
- {
- var $path;
- var $server;
- var $port=0;
- var $method='http';
- var $errno;
- var $errstr;
- var $debug=0;
- var $username='';
- var $password='';
- var $cert='';
- var $certpass='';
- var $key='';
- var $keypass='';
- var $verifypeer=1;
- var $verifyhost=1;
- var $no_multicall=false;
- var $proxy = '';
- var $proxyport=0;
- var $proxy_user = '';
- var $proxy_pass = '';
- var $cookies=array();
- /**
- * List of http compression methods accepted by the client for responses.
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
- *
- * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
- * in those cases it will be up to CURL to decide the compression methods
- * it supports. You might check for the presence of 'zlib' in the output of
- * curl_version() to determine wheter compression is supported or not
- */
- var $accepted_compression = array();
- /**
- * Name of compression scheme to be used for sending requests.
- * Either null, gzip or deflate
- */
- var $request_compression = '';
- /**
- * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
- * http://curl.haxx.se/docs/faq.html#7.3)
- */
- var $xmlrpc_curl_handle = null;
- /// Wheter to use persistent connections for http 1.1 and https
- var $keepalive = false;
- /// Charset encodings that can be decoded without problems by the client
- var $accepted_charset_encodings = array();
- /// Charset encoding to be used in serializing request. NULL = use ASCII
- var $request_charset_encoding = '';
- /**
- * Decides the content of xmlrpcresp objects returned by calls to send()
- * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
- */
- var $return_type = 'xmlrpcvals';
-
- /**
- * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
- * @param string $server the server name / ip address
- * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
- * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
- */
- function xmlrpc_client($path, $server='', $port='', $method='')
- {
- // allow user to specify all params in $path
- if($server == '' and $port == '' and $method == '')
- {
- $parts = parse_url($path);
- $server = $parts['host'];
- $path = $parts['path'];
- if(isset($parts['query']))
- {
- $path .= '?'.$parts['query'];
- }
- if(isset($parts['fragment']))
- {
- $path .= '#'.$parts['fragment'];
- }
- if(isset($parts['port']))
- {
- $port = $parts['port'];
- }
- if(isset($parts['scheme']))
- {
- $method = $parts['scheme'];
- }
- if(isset($parts['user']))
- {
- $this->username = $parts['user'];
- }
- if(isset($parts['pass']))
- {
- $this->password = $parts['pass'];
- }
- }
- if($path == '' || $path[0] != '/')
- {
- $this->path='/'.$path;
- }
- else
- {
- $this->path=$path;
- }
- $this->server=$server;
- if($port != '')
- {
- $this->port=$port;
- }
- if($method != '')
- {
- $this->method=$method;
- }
-
- // if ZLIB is enabled, let the client by default accept compressed responses
- if(function_exists('gzinflate') || (
- function_exists('curl_init') && (($info = curl_version()) &&
- ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
- ))
- {
- $this->accepted_compression = array('gzip', 'deflate');
- }
-
- // keepalives: enabled by default ONLY for PHP >= 4.3.8
- // (see http://curl.haxx.se/docs/faq.html#7.3)
- if(version_compare(phpversion(), '4.3.8') >= 0)
- {
- $this->keepalive = true;
- }
-
- // by default the xml parser can support these 3 charset encodings
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
- }
-
- /*
- * Enables/disables the echoing to screen of the xmlrpc responses received
- * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, beside received response)
- * @access public
- */
- function setDebug($in)
- {
- $this->debug=$in;
- }
-
- /*
- * Add some http BASIC AUTH credentials, used by the client to authenticate
- * @param string $u username
- * @param string $p password
- * @access public
- */
- function setCredentials($u, $p)
- {
- $this->username=$u;
- $this->password=$p;
- }
-
- /*
- * Add a client-side https certificate
- * @param string $cert
- * @param string $certpass
- * @access public
- */
- function setCertificate($cert, $certpass)
- {
- $this->cert = $cert;
- $this->certpass = $certpass;
- }
-
- /*
- * @param string $key The name of a file containing a private SSL key
- * @param string $keypass The secret password needed to use the private SSL key
- * @access public
- * NB: does not work in older php/curl installs
- * Thanks to Daniel Convissor
- */
- function setKey($key, $keypass)
- {
- $this->key = $key;
- $this->keypass = $keypass;
- }
-
- /*
- * @access public
- */
- function setSSLVerifyPeer($i)
- {
- $this->verifypeer = $i;
- }
-
- /*
- * @access public
- */
- function setSSLVerifyHost($i)
- {
- $this->verifyhost = $i;
- }
-
- /**
- * Set proxy info
- *
- * @param string $proxyhost
- * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
- * @param string $proxyusername Leave blank if proxy has public access
- * @param string $proxypassword Leave blank if proxy has public access
- * @access public
- */
- function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '')
- {
- $this->proxy = $proxyhost;
- $this->proxyport = $proxyport;
- $this->proxy_user = $proxyusername;
- $this->proxy_pass = $proxypassword;
- }
-
- /**
- * Enables/disables reception of compressed xmlrpc responses.
- * Note that enabling reception of compressed responses merely adds some standard
- * http headers to xmlrpc requests. It is up to the xmlrpc server to return
- * compressed responses when receiving such requests.
- * @param string $compmethod either 'gzip', 'deflate', 'any' or ''
- * @access public
- */
- function setAcceptedCompression($compmethod)
- {
- if ($compmethod == 'any')
- $this->accepted_compression = array('gzip', 'deflate');
- else
- $this->accepted_compression = array($compmethod);
- }
-
- /**
- * Enables/disables http compression of xmlrpc request.
- * Take care when sending compressed requests: servers might not support them
- * (and automatic fallback to uncompressed requests is not yet implemented)
- * @param string $compmethod either 'gzip', 'deflate' or ''
- * @access public
- */
- function setRequestCompression($compmethod)
- {
- $this->request_compression = $compmethod;
- }
-
- /**
- * Adds a cookie to list of cookies that will be sent to server.
- * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:
- * do not do it unless you know what you are doing
- * @param string $name
- * @param string $value
- * @param string $path
- * @param string $domain
- * @param string $port
- * @access public
- *
- * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
- */
- function setCookie($name, $value='', $path='', $domain='', $port=null)
- {
- $this->cookies[$name]['value'] = urlencode($value);
- if ($path || $domain || $port)
- {
- $this->cookies[$name]['path'] = $path;
- $this->cookies[$name]['domain'] = $domain;
- $this->cookies[$name]['port'] = $port;
- $this->cookies[$name]['version'] = 1;
- }
- else
- {
- $this->cookies[$name]['version'] = 0;
- }
- }
-
- /**
- * Send an xmlrpc request
- * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request
- * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply
- * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used
- */
- function& send($msg, $timeout=0, $method='')
- {
- // if user deos not specify http protocol, use native method of this client
- // (i.e. method set during call to constructor)
- if($method == '')
- {
- $method = $this->method;
- }
-
- if(is_array($msg))
- {
- // $msg is an array of xmlrpcmsg's
- $r = $this->multicall($msg, $timeout, $method);
- return $r;
- }
- elseif(is_string($msg))
- {
- $n =& new xmlrpcmsg('');
- $n->payload = $msg;
- $msg = $n;
- }
-
- // where msg is an xmlrpcmsg
- $msg->debug=$this->debug;
-
- if($method == 'https')
- {
- $r =& $this->sendPayloadHTTPS(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- $this->cert,
- $this->certpass,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass,
- $this->keepalive,
- $this->key,
- $this->keypass
- );
- }
- elseif($method == 'http11')
- {
- $r =& $this->sendPayloadCURL(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- null,
- null,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass,
- 'http',
- $this->keepalive
- );
- }
- else
- {
- $r =& $this->sendPayloadHTTP10(
- $msg,
- $this->server,
- $this->port,
- $timeout,
- $this->username,
- $this->password,
- $this->proxy,
- $this->proxyport,
- $this->proxy_user,
- $this->proxy_pass
- );
- }
-
- return $r;
- }
-
- /**
- * @access private
- */
- function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,$username='', $password='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='')
- {
- if($port==0)
- {
- $port=80;
- }
-
- // Only create the payload if it was not created previously
- if(empty($msg->payload))
- {
- $msg->createPayload($this->request_charset_encoding);
- }
-
- $payload = $msg->payload;
- // Deflate request body and set appropriate request headers
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
- {
- if($this->request_compression == 'gzip')
- {
- $a = @gzencode($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: gzip\r\n";
- }
- }
- else
- {
- $a = @gzdeflate($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: deflate\r\n";
- }
- }
- }
- else
- {
- $encoding_hdr = '';
- }
-
- // thanks to Grant Rauscher <grant7@firstworld.net>
- // for this
- $credentials='';
- if($username!='')
- {
- $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
- }
-
- $accepted_encoding = '';
- if(is_array($this->accepted_compression) && count($this->accepted_compression))
- {
- $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
- }
-
- $proxy_credentials = '';
- if($proxyhost)
- {
- if($proxyport == 0)
- {
- $proxyport = 8080;
- }
- $connectserver = $proxyhost;
- $connectport = $proxyport;
- $uri = 'http://'.$server.':'.$port.$this->path;
- if($proxyusername != '')
- {
- $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
- }
- }
- else
- {
- $connectserver = $server;
- $connectport = $port;
- $uri = $this->path;
- }
-
- // Cookie generation, as per rfc2965 (version 1 cookies) or
- // netscape's rules (version 0 cookies)
- $cookieheader='';
- foreach ($this->cookies as $name => $cookie)
- {
- if ($cookie['version'])
- {
- $cookieheader .= 'Cookie: $Version="' . $cookie['version'] . '"; ';
- $cookieheader .= $name . '="' . $cookie['value'] . '";';
- if ($cookie['path'])
- $cookieheader .= ' $Path="' . $cookie['path'] . '";';
- if ($cookie['domain'])
- $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
- if ($cookie['port'])
- $cookieheader .= ' $Port="' . $cookie['domain'] . '";';
- $cookieheader = substr($cookieheader, 0, -1) . "\r\n";
- }
- else
- {
- $cookieheader .= 'Cookie: ' . $name . '=' . $cookie['value'] . "\r\n";
- }
- }
-
- $op= "POST " . $uri. " HTTP/1.0\r\n" .
- "User-Agent: " . $GLOBALS['xmlrpcName'] . " " . $GLOBALS['xmlrpcVersion'] . "\r\n" .
- "Host: ". $server . "\r\n" .
- $credentials .
- $proxy_credentials .
- $accepted_encoding .
- $encoding_hdr .
- "Accept-Charset: " . implode(',', $this->accepted_charset_encodings) . "\r\n" .
- $cookieheader .
- "Content-Type: " . $msg->content_type . "\r\nContent-Length: " .
- strlen($payload) . "\r\n\r\n" .
- $payload;
-
-
- if($this->debug > 1)
- {
- print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
- // let the client see this now in case http times out...
- flush();
- }
-
- if($timeout>0)
- {
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
- }
- else
- {
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
- }
- if($fp)
- {
- if($timeout>0 && function_exists('stream_set_timeout'))
- {
- stream_set_timeout($fp, $timeout);
- }
- }
- else
- {
- $this->errstr='Connect error: '.$this->errstr;
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
- return $r;
- }
-
- if(!fputs($fp, $op, strlen($op)))
- {
- $this->errstr='Write error';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
- return $r;
- }
- else
- {
- // reset errno and errstr on succesful socket connection
- $this->errstr = '';
- }
- // G. Giunta 2005/10/24: close socket before parsing.
- // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
- //$resp=&$msg->parseResponseFile($fp);
- $ipd='';
- while($data=fread($fp, 32768))
- {
- // shall we check for $data === FALSE?
- // as per the manual, it signals an error
- $ipd.=$data;
- }
- fclose($fp);
- $r =& $msg->parseResponse($ipd, false, $this->return_type);
- return $r;
-
- }
-
- /**
- * @access private
- */
- function &sendPayloadHTTPS($msg, $server, $port, $timeout=0,$username='', $password='', $cert='',$certpass='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $keepalive=false, $key='', $keypass='')
- {
- $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username, $password, $cert, $certpass,
- $proxyhost, $proxyport, $proxyusername, $proxypassword, 'https', $keepalive, $key, $keypass);
- return $r;
- }
-
- /**
- * Contributed by Justin Miller <justin@voxel.net>
- * Requires curl to be built into PHP
- * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
- * @access private
- */
- function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', $password='', $cert='', $certpass='',
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $method='https', $keepalive=false,
- $key='', $keypass='')
- {
- if(!function_exists('curl_init'))
- {
- $this->errstr='CURL unavailable on this install';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
- return $r;
- }
- if($method == 'https')
- {
- if(($info = curl_version()) &&
- ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
- {
- $this->errstr='SSL unavailable on this install';
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
- return $r;
- }
- }
-
- if($port == 0)
- {
- if($method == 'http')
- {
- $port = 80;
- }
- else
- {
- $port = 443;
- }
- }
-
- // Only create the payload if it was not created previously
- if(empty($msg->payload))
- {
- $msg->createPayload($this->request_charset_encoding);
- }
-
- // Deflate request body and set appropriate request headers
- $payload = $msg->payload;
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
- {
- if($this->request_compression == 'gzip')
- {
- $a = @gzencode($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: gzip";
- }
- }
- else
- {
- $a = @gzdeflate($msg->payload);
- if($a)
- {
- $payload = $a;
- $encoding_hdr = "Content-Encoding: deflate";
- }
- }
- }
- else
- {
- $encoding_hdr = '';
- }
-
- if($this->debug > 1)
- {
- print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
- // let the client see this now in case http times out...
- flush();
- }
-
- if(!$keepalive || !$this->xmlrpc_curl_handle)
- {
- $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
- if($keepalive)
- {
- $this->xmlrpc_curl_handle = $curl;
- }
- }
- else
- {
- $curl = $this->xmlrpc_curl_handle;
- }
-
- // results into variable
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
-
- if($this->debug)
- {
- curl_setopt($curl, CURLOPT_VERBOSE, 1);
- }
- curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);
- // required for XMLRPC: post the data
- curl_setopt($curl, CURLOPT_POST, 1);
- // the data
- curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
-
- // return the header too
- curl_setopt($curl, CURLOPT_HEADER, 1);
-
- // will only work with PHP >= 5.0
- // NB: if we set an empty string, CURL will add http header indicating
- // ALL methods it is supporting. This is possibly a better option than
- // letting the user tell what curl can / cannot do...
- if(is_array($this->accepted_compression) && count($this->accepted_compression))
- {
- //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
- // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- curl_setopt($curl, CURLOPT_ENCODING, '');
- }
- // extra headers
- $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
- // if no keepalive is wanted, let the server know it in advance
- if(!$keepalive)
- {
- $headers[] = 'Connection: close';
- }
- // request compression header
- if($encoding_hdr)
- {
- $headers[] = $encoding_hdr;
- }
-
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- // timeout is borked
- if($timeout)
- {
- curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
- }
-
- if($username && $password)
- {
- curl_setopt($curl, CURLOPT_USERPWD,"$username:$password");
- }
-
- if($method == 'https')
- {
- // set cert file
- if($cert)
- {
- curl_setopt($curl, CURLOPT_SSLCERT, $cert);
- }
- // set cert password
- if($certpass)
- {
- curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
- }
- // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- if($key)
- {
- curl_setopt($curl, CURLOPT_SSLKEY, $key);
- }
- // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
- if($keypass)
- {
- curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
- }
- // whether to verify remote host's cert
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
- // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
- }
-
- // proxy info
- if($proxyhost)
- {
- if($proxyport == 0)
- {
- $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
- }
- curl_setopt($curl, CURLOPT_PROXY,$proxyhost.':'.$proxyport);
- //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
- if($proxyusername)
- {
- curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
- }
- }
-
- // NB: should we build cookie http headers by hand rather than let CURL do it?
- // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
- // set to clint obj the the user...
- if (count($this->cookies))
- {
- $cookieheader = '';
- foreach ($this->cookies as $name => $cookie)
- {
- $cookieheader .= $name . '=' . $cookie['value'] . ', ';
- }
- curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
- }
-
- $result = curl_exec($curl);
-
- if(!$result)
- {
- $this->errstr='no response';
- $resp=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
- if(!$keepalive)
- {
- curl_close($curl);
- }
- }
- else
- {
- if(!$keepalive)
- {
- curl_close($curl);
- }
- $resp =& $msg->parseResponse($result, true, $this->return_type);
- }
- return $resp;
- }
-
- /**
- * Send an array of request messages and return an array of responses.
- * Unless $this->no_multicall has been set to true, it will try first
- * to use one single xmlrpc call to server method system.multicall, and
- * revert to sending many successive calls in case of failure.
- * This failure is also stored in $this->no_multicall for subsequent calls.
- * Unfortunately, there is no server error code universally used to denote
- * the fact that multicall is unsupported, so there is no way to reliably
- * distinguish between that and a temporary failure.
- * If you are sure that server supports multicall and do not want to
- * fallback to using many single calls, set the fourth parameter to FALSE.
- *
- * NB: trying to shoehorn extra functionality into existing syntax has resulted
- * in pretty much convoluted code...
- *
- * @access public
- * @param array $msgs an array of xmlrpcmsg objects
- * @param integer $timeout connection timeout (in seconds)
- * @param string $method the http protocol variant to be used
- * @param boolen fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
- */
- function multicall($msgs, $timeout=0, $method='http', $fallback=true)
- {
- if(!$this->no_multicall)
- {
- $results = $this->_try_multicall($msgs, $timeout, $method);
- if(is_array($results))
- {
- // System.multicall succeeded
- return $results;
- }
- else
- {
- // either system.multicall is unsupported by server,
- // or call failed for some other reason.
- if ($fallback)
- {
- // Don't try it next time...
- $this->no_multicall = true;
- }
- else
- {
- if (is_a($result, 'xmlrpcresp'))
- {
- $result = $results;
- }
- else
- {
- $result =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
- }
- }
- }
- }
- else
- {
- // override fallback, in case careless user tries to do two
- // opposite things at the same time
- $fallback = true;
- }
-
- $results = array();
- if ($fallback)
- {
- // system.multicall is (probably) unsupported by server:
- // emulate multicall via multiple requests
- foreach($msgs as $msg)
- {
- $results[] =& $this->send($msg, $timeout, $method);
- }
- }
- else
- {
- // user does NOT want to fallback on many single calls:
- // since we should always return an array of responses,
- // return an array with the same error repeated n times
- foreach($msgs as $msg)
- {
- $results[] = $result;
- }
- }
- return $results;
- }
-
- /**
- * Attempt to boxcar $msgs via system.multicall.
- * Returns either an array of xmlrpcreponses, an xmlrpc error response
- * or false (when recived response does not respect valid multiccall syntax)
- * @access private
- */
- function _try_multicall($msgs, $timeout, $method)
- {
- // Construct multicall message
- $calls = array();
- foreach($msgs as $msg)
- {
- $call['methodName'] =& new xmlrpcval($msg->method(),'string');
- $numParams = $msg->getNumParams();
- $params = array();
- for($i = 0; $i < $numParams; $i++)
- {
- $params[$i] = $msg->getParam($i);
- }
- $call['params'] =& new xmlrpcval($params, 'array');
- $calls[] =& new xmlrpcval($call, 'struct');
- }
- $multicall =& new xmlrpcmsg('system.multicall');
- $multicall->addParam(new xmlrpcval($calls, 'array'));
-
- // Attempt RPC call
- $result =& $this->send($multicall, $timeout, $method);
- //if(!is_object($result))
- //{
- // return ($result || 0); // transport failed
- //}
-
- if($result->faultCode() != 0)
- {
- // call to system.multicall failed
- return $result;
- }
-
- // Unpack responses.
- $rets = $result->value();
-
- if ($this->return_type == 'xml')
- {
- return $rets;
- }
- else if ($this->return_type == 'phpvals')
- {
- ///@todo test this code branch...
- $rets = $result->value();
- if(!is_array($rets))
- {
- return false; // bad return type from system.multicall
- }
- $numRets = count($rets);
- if($numRets != count($msgs))
- {
- return false; // wrong number of return values.
- }
-
- $response = array();
- for($i = 0; $i < $numRets; $i++)
- {
- $val = $rets[$i];
- if (!is_array($val)) {
- return false;
- }
- switch(count($val))
- {
- case 1:
- if(!isset($val[0]))
- {
- return false; // Bad value
- }
- // Normal return value
- $response[$i] =& new xmlrpcresp($val[0], 0, '', 'phpvals');
- break;
- case 2:
- /// @todo remove usage of @: it is apparently quite slow
- $code = @$val['faultCode'];
- if(!is_int($code))
- {
- return false;
- }
- $str = @$val['faultString'];
- if(!is_string($str))
- {
- return false;
- }
- $response[$i] =& new xmlrpcresp(0, $code, $str);
- break;
- default:
- return false;
- }
- }
- return $response;
- }
- else // return type == 'xmlrpcvals'
- {
- $rets = $result->value();
- if($rets->kindOf() != 'array')
- {
- return false; // bad return type from system.multicall
- }
- $numRets = $rets->arraysize();
- if($numRets != count($msgs))
- {
- return false; // wrong number of return values.
- }
-
- $response = array();
- for($i = 0; $i < $numRets; $i++)
- {
- $val = $rets->arraymem($i);
- switch($val->kindOf())
- {
- case 'array':
- if($val->arraysize() != 1)
- {
- return false; // Bad value
- }
- // Normal return value
- $response[$i] =& new xmlrpcresp($val->arraymem(0));
- break;
- case 'struct':
- $code = $val->structmem('faultCode');
- if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
- {
- return false;
- }
- $str = $val->structmem('faultString');
- if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
- {
- return false;
- }
- $response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
- break;
- default:
- return false;
- }
- }
- return $response;
- }
- }
- } // end class xmlrpc_client
-
- class xmlrpcresp
- {
- var $val = 0;
- var $valtyp;
- var $errno = 0;
- var $errstr = '';
- var $hdrs = array();
- var $_cookies = array();
- var $content_type = 'text/xml';
-
- /**
- * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
- * @param integer $fcode set it to anything but 0 to create an error response
- * @param string $fstr the error string, in case of an error response
- * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
- *
- * @todo add check that $val is of correct type???
- * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
- * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
- */
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
- {
- if($fcode != 0)
- {
- // error response
- $this->errno = $fcode;
- $this->errstr = $fstr;
- //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
- }
- /*elseif(!is_object($val) || !is_a($val, 'xmlrpcval'))
- {
- // programmer error
- error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to xmlrpcresp. Defaulting to empty value.");
- $this->val =& new xmlrpcval();
- }*/
- else
- {
- // successful response
- $this->val = $val;
- if ($valtyp == '')
- {
- // user did not declare type of response value: try to guess it
- if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
- {
- $this->valtyp = 'xmlrpcvals';
- }
- else if (is_string($this->val))
- {
- $this->valtyp = 'xml';
-
- }
- else
- {
- $this->valtyp = 'phpvals';
- }
- }
- else
- {
- // user declares type of resp value: believe him
- $this->valtyp = $valtyp;
- }
- }
- }
-
- /*
- * @return integer the error code of this response (0 for not-error responses)
- */
- function faultCode()
- {
- return $this->errno;
- }
-
- /*
- * @return string the error string of this response ('' for not-error responses)
- */
- function faultString()
- {
- return $this->errstr;
- }
-
- /*
- * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects
- */
- function value()
- {
- return $this->val;
- }
-
- /**
- * Returns an array with the cookies received from the server.
- * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
- * with attributes being e.g. 'expires', 'path', domain'.
- * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
- * are still present in the array. It is up to the user-defined code to decide
- * how to use the received cookies, and wheter they have to be sent back with the next
- * request to the server (using xmlrpc_client::setCookie) or not
- * @return array array of cookies received from the server
- * @access public
- */
- function cookies()
- {
- return $this->_cookies;
- }
-
- /**
- * Return xml representation of the response
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
- * @return string the xml representation of the response
- */
- function serialize($charset_encoding='')
- {
- if ($charset_encoding != '')
- $this->content_type = 'text/xml; charset=' . $charset_encoding;
- else
- $this->content_type = 'text/xml';
- $result = "<methodResponse>\n";
- if($this->errno)
- {
- // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
- // by xml-encoding non ascii chars
- $result .= "<fault>\n" .
-"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
-"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
-xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
-"</struct>\n</value>\n</fault>";
- }
- else
- {
- if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
- {
- if (is_string($this->val) && $this->valtyp == 'xml')
- {
- $result .= "<params>\n<param>\n" .
- $this->val .
- "</param>\n</params>";
- }
- else
- {
- /// @todo try to build something serializable?
- die('cannot serialize xmlrpcresp objects whose content is native php values');
- }
- }
- else
- {
- $result .= "<params>\n<param>\n" .
- $this->val->serialize($charset_encoding) .
- "</param>\n</params>";
- }
- }
- $result .= "\n</methodResponse>";
- return $result;
- }
- }
-
- class xmlrpcmsg
- {
- var $payload;
- var $methodname;
- var $params=array();
- var $debug=0;
- var $content_type = 'text/xml';
-
- /*
- * @param string $meth the name of the method to invoke
- * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
- */
- function xmlrpcmsg($meth, $pars=0)
- {
- $this->methodname=$meth;
- if(is_array($pars) && sizeof($pars)>0)
- {
- for($i=0; $i<sizeof($pars); $i++)
- {
- $this->addParam($pars[$i]);
- }
- }
- }
-
- function xml_header()
- {
- return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
- }
-
- function xml_footer()
- {
- return "</methodCall>";
- }
-
- function kindOf()
- {
- return 'msg';
- }
-
- function createPayload($charset_encoding='')
- {
- if ($charset_encoding != '')
- $this->content_type = 'text/xml; charset=' . $charset_encoding;
- else
- $this->content_type = 'text/xml';
- $this->payload=$this->xml_header();
- $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
- // if(sizeof($this->params)) {
- $this->payload.="<params>\n";
- for($i=0; $i<sizeof($this->params); $i++)
- {
- $p=$this->params[$i];
- $this->payload.="<param>\n" . $p->serialize($charset_encoding) .
- "</param>\n";
- }
- $this->payload.="</params>\n";
- // }
- $this->payload.=$this->xml_footer();
- //$this->payload=str_replace("\n", "\r\n", $this->payload);
- }
-
- /*
- * Gets/sets the xmlrpc method to be invoked
- * @param string $meth the method to be set (leave empty not to set it)
- * @return string the method that will be invoked
- * @access public
- */
- function method($meth='')
- {
- if($meth!='')
- {
- $this->methodname=$meth;
- }
- return $this->methodname;
- }
-
- /*
- * @return string the xml representation of the message
- */
- function serialize($charset_encoding='')
- {
- $this->createPayload($charset_encoding);
- return $this->payload;
- }
-
- /*
- * Add a parameter to the list of parameters to be used upon method invocation
- * @param xmlrpcval $par
- * @return boolean false on failure
- */
- function addParam($par)
- {
- // add check: do not add to self params which are not xmlrpcvals
- if(is_object($par) && is_a($par, 'xmlrpcval'))
- {
- $this->params[]=$par;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /*
- * @param integer $i the index of the parameter to fetch (zero based)
- * @return xmlrpcval the i-th parameter
- */
- function getParam($i) { return $this->params[$i]; }
-
- /*
- * @return integer the number of parameters currently set
- */
- function getNumParams() { return sizeof($this->params); }
-
- /*
- * @access private
- * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
- */
- function &parseResponseFile($fp)
- {
- $ipd='';
- while($data=fread($fp, 32768))
- {
- $ipd.=$data;
- }
- //fclose($fp);
- $r =& $this->parseResponse($ipd);
- return $r;
- }
-
- /**
- * Parses HTTP headers and separates them from data.
- * @access private
- */
- function &parseResponseHeaders(&$data, $headers_processed=false)
- {
- // Strip HTTP 1.1 100 Continue header if present
- while(ereg('^HTTP/1\.1 1[0-9]{2} ', $data))
- {
- $pos = strpos($data, 'HTTP', 12);
- // server sent a Continue header without any (valid) content following...
- // give the client a chance to know it
- if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
- {
- break;
- }
- $data = substr($data, $pos);
- }
- if(!ereg('^HTTP/[0-9.]+ 200 ', $data))
- {
- $errstr= substr($data, 0, strpos($data, "\n")-1);
- error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr);
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
- return $r;
- }
-
- $GLOBALS['_xh']['headers'] = array();
- $GLOBALS['_xh']['cookies'] = array();
-
- // be tolerant to usage of \n instead of \r\n to separate headers and data
- // (even though it is not valid http)
- $pos = strpos($data,"\r\n\r\n");
- if($pos || is_int($pos))
- {
- $bd = $pos+4;
- }
- else
- {
- $pos = strpos($data,"\n\n");
- if($pos || is_int($pos))
- {
- $bd = $pos+2;
- }
- else
- {
- // No separation between response headers and body: fault?
- $bd = 0;
- }
- }
- // be tolerant to line endings, and extra empty lines
- $ar = split("\r?\n", trim(substr($data, 0, $pos)));
- while(list(,$line) = @each($ar))
- {
- // take care of multi-line headers and cookies
- $arr = explode(':',$line,2);
- if(count($arr) > 1)
- {
- $header_name = strtolower(trim($arr[0]));
- /// @todo some other headers (the ones that allow a CSV list of values)
- /// do allow many values to be passed using multiple header lines.
- /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
- /// instead of replacing it for those...
- if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
- {
- if ($header_name == 'set-cookie2')
- {
- // version 2 cookies:
- // there could be many cookies on one line, comma separated
- $cookies = explode(',', $arr[1]);
- }
- else
- {
- $cookies = array($arr[1]);
- }
- foreach ($cookies as $cookie)
- {
- // glue together all received cookies, using a comma to separate them
- // (same as php does with getallheaders())
- if (isset($GLOBALS['_xh']['headers'][$header_name]))
- $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
- else
- $GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
- // parse cookie attributes, in case user wants to coorectly honour then
- // feature creep: only allow rfc-compliant cookie attributes?
- $cookie = explode(';', $cookie);
- foreach ($cookie as $pos => $val)
- {
- $val = explode('=', $val, 2);
- $tag = trim($val[0]);
- $val = trim(@$val[1]);
- /// @todo with version 1 cookies, we should strip leading and trailing " chars
- if ($pos == 0)
- {
- $cookiename = $tag;
- $GLOBALS['_xh']['cookies'][$tag] = array();
- $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
- }
- else
- {
- $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
- }
- }
- }
- }
- else
- {
- $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
- }
- }
- elseif(isset($header_name))
- {
- /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
- $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
- }
- }
- // rebuild full cookie set
- /*if (isset($GLOBALS['_xh']['headers']['set-cookie']))
- {
- $cookies = array();
- $received = explode(';', $GLOBALS['_xh']['headers']['set-cookie']);
- foreach($received as $cookie)
- {
- list($name, $value) = explode('=', $cookie);
- $name = trim($name);
- $value = trim($value);
- // these values are in fact attributes
- if ($name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment' && $name != 'Comment')
- {
- $cookies[$name] = $value;
- }
- }
- }*/
-
- $data = substr($data, $bd);
-
- if($this->debug && count($GLOBALS['_xh']['headers']))
- {
- print '<PRE>';
- foreach($GLOBALS['_xh']['headers'] as $header => $value)
- {
- print "HEADER: $header: $value\n";
- }
- foreach($GLOBALS['_xh']['cookies'] as $header => $value)
- {
- print "COOKIE: $header={$value['value']}\n";
- }
- print "</PRE>\n";
- }
-
- // if CURL was used for the call, http headers have been processed,
- // and dechunking + reinflating have been carried out
- if(!$headers_processed)
- {
- // Decode chunked encoding sent by http 1.1 servers
- if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
- {
- if(!$data = decode_chunked($data))
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
- return $r;
- }
- }
-
- // Decode gzip-compressed stuff
- // code shamelessly inspired from nusoap library by Dietrich Ayala
- if(isset($GLOBALS['_xh']['headers']['content-encoding']))
- {
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
- {
- // if decoding works, use it. else assume data wasn't gzencoded
- if(function_exists('gzinflate'))
- {
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzinflate($data))
- {
- $data = $degzdata;
- if($this->debug)
- print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
- }
- elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
- {
- $data = $degzdata;
- if($this->debug)
- print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
- }
- else
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
- return $r;
- }
- }
- else
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
- return $r;
- }
- }
- }
- } // end of 'if needed, de-chunk, re-inflate response'
-
- // real stupid hack to avoid PHP 4 complaining about returning NULL by ref
- $r = null;
- $r =& $r;
- return $r;
- }
-
- /*
- * @param string $data the xmlrpc response, eventually including http headers
- * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and conseuqent decoding
- * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
- * @access private
- */
- function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
- {
- //$hdrfnd = 0;
- if($this->debug)
- {
- //by maHo, replaced htmlspecialchars with htmlentities
- print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
- $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
- if ($start)
- {
- $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
- $end = strpos($data, '-->', $start);
- $comments = substr($data, $start, $end-$start);
- print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
- }
- }
-
- if($data == '')
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
- return $r;
- }
-
- $GLOBALS['_xh']=array();
-
- // parse the HTTP headers of the response, if present, and separate them from data
- if(ereg("^HTTP",$data))
- {
- $r =& $this->parseResponseHeaders($data, $headers_processed);
- if ($r)
- {
- return $r;
- }
- }
- else
- {
- $GLOBALS['_xh']['headers'] = array();
- $GLOBALS['_xh']['cookies'] = array();
- }
-
-
- // be tolerant of extra whitespace in response body
- $data = trim($data);
-
- /// @todo return an error msg if $data=='' ?
-
- // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
- // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
- $bd = false;
- // Poor man's version of strrpos for php 4...
- $pos = strpos($data, '</methodResponse>');
- while($pos || is_int($pos))
- {
- $bd = $pos+17;
- $pos = strpos($data, '</methodResponse>', $bd);
- }
- if($bd)
- {
- $data = substr($data, 0, $bd);
- }
-
- // if user wants back raw xml, give it to him
- if ($return_type == 'xml')
- {
- $r =& new xmlrpcresp($data, 0, '', 'xml');
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
-
- // try to 'guestimate' the character encoding of the received response
- $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
-
- $GLOBALS['_xh']['stack'] = array();
- $GLOBALS['_xh']['valuestack'] = array();
- $GLOBALS['_xh']['isf']=0;
- $GLOBALS['_xh']['isf_reason']='';
- $GLOBALS['_xh']['ac']='';
- $GLOBALS['_xh']['qt']='';
-
- // if response charset encoding is not known / supported, try to use
- // the default encoding and parse the xml anyway, but log a warning...
- if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- // the following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
- //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- {
- error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding);
- $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
- }
- $parser = xml_parser_create($resp_encoding);
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
- // the xml parser to give us back data in the expected charset
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
-
- if ($return_type == 'phpvals')
- {
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
- }
- else
- {
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
- }
-
- xml_set_character_data_handler($parser, 'xmlrpc_cd');
- xml_set_default_handler($parser, 'xmlrpc_dh');
-
- if(!xml_parse($parser, $data, sizeof($data)))
- {
- // thanks to Peter Kocks <peter.kocks@baygate.com>
- if((xml_get_current_line_number($parser)) == 1)
- {
- $errstr = 'XML error at line 1, check URL';
- }
- else
- {
- $errstr = sprintf('XML error: %s at line %d',
- xml_error_string(xml_get_error_code($parser)),
- xml_get_current_line_number($parser));
- }
- error_log($errstr);
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
- xml_parser_free($parser);
- if($this->debug)
- {
- print $errstr;
- }
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
- xml_parser_free($parser);
- if ($GLOBALS['_xh']['isf'] > 1)
- {
- if ($this->debug)
- {
- /// @todo echo something for user?
- }
-
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
- $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
- }
- elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
- {
- // then something odd has happened
- // and it's time to generate a client side error
- // indicating something odd went on
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
- $GLOBALS['xmlrpcstr']['invalid_return']);
- }
- else
- {
- if ($this->debug)
- {
- print "<PRE>---PARSED---\n" ;
- var_export($GLOBALS['_xh']['value']);
- print "\n---END---</PRE>";
- } // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
-
- $v =& $GLOBALS['_xh']['value'];
-
- if($GLOBALS['_xh']['isf'])
- {
- if ($return_type == 'xmlrpcvals')
- {
- $errno_v = $v->structmem('faultCode');
- $errstr_v = $v->structmem('faultString');
- $errno = $errno_v->scalarval();
- $errstr = $errstr_v->scalarval();
- }
- else
- {
- $errno = $v['faultCode'];
- $errstr = $v['faultString'];
- }
-
- if($errno == 0)
- {
- // FAULT returned, errno needs to reflect that
- $errno = -1;
- }
-
- $r =& new xmlrpcresp($v, $errno, $errstr);
- }
- else
- {
- $r=&new xmlrpcresp($v, 0, '', 'phpvals');
- }
- }
-
- $r->hdrs = $GLOBALS['_xh']['headers'];
- $r->_cookies = $GLOBALS['_xh']['cookies'];
- return $r;
- }
- }
-
- class xmlrpcval
- {
- var $me=array();
- var $mytype=0;
- var $_php_class=null;
-
- function xmlrpcval($val=-1, $type='')
- {
- //$this->me=array();
- //$this->mytype=0;
- if($val!==-1 || $type!='')
- {
- if($type=='')
- {
- $type='string';
- }
- if($GLOBALS['xmlrpcTypes'][$type]==1)
- {
- $this->addScalar($val,$type);
- }
- elseif($GLOBALS['xmlrpcTypes'][$type]==2)
- {
- $this->addArray($val);
- }
- elseif($GLOBALS['xmlrpcTypes'][$type]==3)
- {
- $this->addStruct($val);
- }
- }
- }
-
- function addScalar($val, $type='string')
- {
- $typeof=@$GLOBALS['xmlrpcTypes'][$type];
- if($typeof!=1)
- {
- error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($typeof)");
- return 0;
- }
-
- // coerce booleans into correct values
- // NB: shall we do it for datetimes, integers and doubles, too?
- if($type==$GLOBALS['xmlrpcBoolean'])
- {
- if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
- {
- $val=true;
- }
- else
- {
- $val=false;
- }
- }
-
- switch($this->mytype)
- {
- case 1:
- error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value');
- return 0;
- case 3:
- error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval');
- return 0;
- case 2:
- // we're adding a scalar value to an array here
- //$ar=$this->me['array'];
- //$ar[]=&new xmlrpcval($val, $type);
- //$this->me['array']=$ar;
- // Faster (?) avoid all the costly array-copy-by-val done here...
- $this->me['array'][]=&new xmlrpcval($val, $type);
- return 1;
- default:
- // a scalar, so set the value and remember we're scalar
- $this->me[$type]=$val;
- $this->mytype=$typeof;
- return 1;
- }
- }
-
- /// @todo add some checking for $vals to be an array of xmlrpcvals?
- function addArray($vals)
- {
- if($this->mytype==0)
- {
- $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
- $this->me['array']=$vals;
- return 1;
- }
- elseif($this->mytype==2)
- {
- // we're adding to an array here
- $this->me['array'] = array_merge($this->me['array'], $vals);
- }
- else
- {
- error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']');
- return 0;
- }
- }
-
- /// @todo add some checking for $vals to be an array?
- function addStruct($vals)
- {
- if($this->mytype==0)
- {
- $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
- $this->me['struct']=$vals;
- return 1;
- }
- elseif($this->mytype==3)
- {
- // we're adding to a struct here
- $this->me['struct'] = array_merge($this->me['struct'], $vals);
- }
- else
- {
- error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']');
- return 0;
- }
- }
-
- // poor man's version of print_r ???
- // DEPRECATED!
- function dump($ar)
- {
- foreach($ar as $key => $val)
- {
- echo "$key => $val<br />";
- if($key == 'array')
- {
- while(list($key2, $val2) = each($val))
- {
- echo "-- $key2 => $val2<br />";
- }
- }
- }
- }
-
- function kindOf()
- {
- switch($this->mytype)
- {
- case 3:
- return 'struct';
- break;
- case 2:
- return 'array';
- break;
- case 1:
- return 'scalar';
- break;
- default:
- return 'undef';
- }
- }
-
- function serializedata($typ, $val, $charset_encoding='')
- {
- $rs='';
- switch(@$GLOBALS['xmlrpcTypes'][$typ])
- {
- case 3:
- // struct
- if ($this->_php_class)
- {
- $rs.='<struct php_class="' . $this->_php_class . "\">\n";
- }
- else
- {
- $rs.="<struct>\n";
- }
- foreach($val as $key2 => $val2)
- {
- $rs.="<member><name>${key2}</name>\n";
- //$rs.=$this->serializeval($val2);
- $rs.=$val2->serialize();
- $rs.="</member>\n";
- }
- $rs.='</struct>';
- break;
- case 2:
- // array
- $rs.="<array>\n<data>\n";
- for($i=0; $i<sizeof($val); $i++)
- {
- //$rs.=$this->serializeval($val[$i]);
- $rs.=$val[$i]->serialize();
- }
- $rs.="</data>\n</array>";
- break;
- case 1:
- switch($typ)
- {
- case $GLOBALS['xmlrpcBase64']:
- $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
- break;
- case $GLOBALS['xmlrpcBoolean']:
- $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
- break;
- case $GLOBALS['xmlrpcString']:
- // G. Giunta 2005/2/13: do NOT use htmlentities, since
- // it will produce named html entities, which are invalid xml
- $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
- // $rs.="<${typ}>" . htmlentities($val). "</${typ}>";
- break;
- case $GLOBALS['xmlrpcInt']:
- case $GLOBALS['xmlrpcI4']:
- $rs.="<${typ}>".(int)$val."</${typ}>";
- break;
- case $GLOBALS['xmlrpcDouble']:
- $rs.="<${typ}>".(double)$val."</${typ}>";
- break;
- default:
- // no standard type value should arrive here, but provide a possibility
- // for xmlrpcvals of unknown type...
- $rs.="<${typ}>${val}</${typ}>";
- }
- break;
- default:
- break;
- }
- return $rs;
- }
-
- /**
- * Return xml representation of the value
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
- */
- function serialize($charset_encoding='')
- {
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
- //{
- reset($this->me);
- list($typ, $val) = each($this->me);
- return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
- //}
- }
-
- // DEPRECATED
- function serializeval($o)
- {
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
- //{
- $ar=$o->me;
- reset($ar);
- list($typ, $val) = each($ar);
- return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
- //}
- }
-
- /**
- * Checks wheter a struct member with a given name is present.
- * Works only on xmlrpcvals of type struct.
- * @param string $m the name of the struct member to be looked up
- * @return boolean
- */
- function structmemexists($m)
- {
- return array_key_exists($this->me['struct'][$m]);
- }
-
- /*
- * Returns the value of a given struct member (an xmlrpcval object in itself).
- * Will raise a php warning if struct member of given name does not exist
- * @param string $m the name of the struct member to be looked up
- * @return xmlrpcval
- */
- function structmem($m)
- {
- return $this->me['struct'][$m];
- }
-
- function structreset()
- {
- reset($this->me['struct']);
- }
-
- function structeach()
- {
- return each($this->me['struct']);
- }
-
- // DEPRECATED! this code looks like it is very fragile and has not been fixed
- // for a long long time. Shall we remove it for 2.0?
- function getval()
- {
- // UNSTABLE
- reset($this->me);
- list($a,$b)=each($this->me);
- // contributed by I Sofer, 2001-03-24
- // add support for nested arrays to scalarval
- // i've created a new method here, so as to
- // preserve back compatibility
-
- if(is_array($b))
- {
- @reset($b);
- while(list($id,$cont) = @each($b))
- {
- $b[$id] = $cont->scalarval();
- }
- }
-
- // add support for structures directly encoding php objects
- if(is_object($b))
- {
- $t = get_object_vars($b);
- @reset($t);
- while(list($id,$cont) = @each($t))
- {
- $t[$id] = $cont->scalarval();
- }
- @reset($t);
- while(list($id,$cont) = @each($t))
- {
- //@eval('$b->'.$id.' = $cont;');
- @$b->$id = $cont;
- }
- }
- // end contrib
- return $b;
- }
-
- /**
- * Returns the value of a scalar xmlrpcval
- * @return mixed
- */
- function scalarval()
- {
- reset($this->me);
- list(,$b)=each($this->me);
- return $b;
- }
-
- /**
- * Returns the type of the xmlrpcval.
- * For integers, 'int' is always returned in place of 'i4'
- * @return string
- */
- function scalartyp()
- {
- reset($this->me);
- list($a,$b)=each($this->me);
- if($a==$GLOBALS['xmlrpcI4'])
- {
- $a=$GLOBALS['xmlrpcInt'];
- }
- return $a;
- }
-
- /**
- * Returns the m-th member of an xmlrpcval of struct type
- * @param integer $m the index of the value to be retrieved (zero based)
- * @return xmlrpcval
- */
- function arraymem($m)
- {
- return $this->me['array'][$m];
- }
-
- /**
- * Returns the number of members in an xmlrpcval of array type
- * @return integer
- */
- function arraysize()
- {
- return count($this->me['array']);
- }
-
- /**
- * Returns the number of members in an xmlrpcval of struct type
- * @return integer
- */
- function structsize()
- {
- return count($this->me['struct']);
- }
- }
-
-
- // date helpers
- function iso8601_encode($timet, $utc=0)
- {
- // return an ISO8601 encoded string
- // really, timezones ought to be supported
- // but the XML-RPC spec says:
- //
- // "Don't assume a timezone. It should be specified by the server in its
- // documentation what assumptions it makes about timezones."
- //
- // these routines always assume localtime unless
- // $utc is set to 1, in which case UTC is assumed
- // and an adjustment for locale is made when encoding
- if(!$utc)
- {
- $t=strftime("%Y%m%dT%H:%M:%S", $timet);
- }
- else
- {
- if(function_exists('gmstrftime'))
- {
- // gmstrftime doesn't exist in some versions
- // of PHP
- $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
- }
- else
- {
- $t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
- }
- }
- return $t;
- }
-
- function iso8601_decode($idate, $utc=0)
- {
- // return a timet in the localtime, or UTC
- $t=0;
- if(ereg("([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $idate, $regs))
- {
- if($utc)
- {
- $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
- }
- else
- {
- $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
- }
- }
- return $t;
- }
-
- /**
- * Takes an xmlrpc value in PHP xmlrpcval object format
- * and translates it into native PHP types.
- * Works with xmlrpc message objects as input, too.
- *
- * @author Dan Libby (dan@libby.com)
- *
- * @param xmlrpcval $xmlrpc_val
- * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
- * @return mixed
- */
- function php_xmlrpc_decode($xmlrpc_val, $options=array())
- {
- switch($xmlrpc_val->kindOf())
- {
- case 'scalar':
- return $xmlrpc_val->scalarval();
- case 'array':
- $size = $xmlrpc_val->arraysize();
- $arr = array();
- for($i = 0; $i < $size; $i++)
- {
- $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
- }
- return $arr;
- case 'struct':
- $xmlrpc_val->structreset();
- // If user said so, try to rebuild php objects for specific struct vals.
- /// @todo should we raise a warning for class not found?
- // shall we check for proper subclass of xmlrpcval instead of
- // presence of _php_class to detect what we can do?
- if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
- && class_exists($xmlrpc_val->_php_class))
- {
- $obj = @new $xmlrpc_val->_php_class;
- while(list($key,$value)=$xmlrpc_val->structeach())
- {
- $obj->$key = php_xmlrpc_decode($value, $options);
- }
- return $obj;
- }
- else
- {
- $arr = array();
- while(list($key,$value)=$xmlrpc_val->structeach())
- {
- $arr[$key] = php_xmlrpc_decode($value, $options);
- }
- return $arr;
- }
- case 'msg':
- $paramcount = $xmlrpc_val->getNumParams();
- $arr = array();
- for($i = 0; $i < $paramcount; $i++)
- {
- $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
- }
- return $arr;
- }
- }
-
- if(function_exists('xmlrpc_decode'))
- {
- define('XMLRPC_EPI_ENABLED','1');
- }
- else
- {
- define('XMLRPC_EPI_ENABLED','0');
- }
-
- /**
- * Takes native php types and encodes them into xmlrpc PHP object format.
- * It will not re-encode xmlrpcval objects.
- * Feature creep -- could support more types via optional type argument
- * (string => datetime support has been added, ??? => base64 not yet)
- *
- * @author Dan Libby (dan@libby.com)
- *
- * @param mixed $php_val the value to be converted into an xmlrpcval object
- * @param array $options can include 'encode_php_objs' and 'auto_dates'
- * @return xmlrpcval
- */
- function &php_xmlrpc_encode($php_val, $options=array())
- {
- $type = gettype($php_val);
- $xmlrpc_val =& new xmlrpcval;
-
- switch($type)
- {
- case 'array':
- // PHP arrays can be encoded to either xmlrpc structs or arrays,
- // depending on wheter they are hashes or plain 0..n integer indexed
- // A shorter one-liner would be
- // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));
- // but execution time skyrockets!
- $j = 0;
- $arr = array();
- $ko = false;
- foreach($php_val as $key => $val)
- {
- $arr[$key] =& php_xmlrpc_encode($val, $options);
- if(!$ko && $key !== $j)
- {
- $ko = true;
- }
- $j++;
- }
- if($ko)
- {
- $xmlrpc_val->addStruct($arr);
- }
- else
- {
- $xmlrpc_val->addArray($arr);
- }
- break;
- case 'object':
- if(is_a($php_val, 'xmlrpcval'))
- {
- $xmlrpc_val = $php_val;
- }
- else
- {
- $arr = array();
- while(list($k,$v) = each($php_val))
- {
- $arr[$k] = php_xmlrpc_encode($v, $options);
- }
- $xmlrpc_val->addStruct($arr);
- if (in_array('encode_php_objs', $options))
- {
- // let's save original class name into xmlrpcval:
- // might be useful later on...
- $xmlrpc_val->_php_class = get_class($php_val);
- }
- }
- break;
- case 'integer':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcInt']);
- break;
- case 'double':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcDouble']);
- break;
- case 'string':
- if (in_array('auto_dates', $options) && ereg("^[0-9]{8}\T{1}[0-9]{2}\:[0-9]{2}\:[0-9]{2}$", $php_val))
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcDateTime']);
- else
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcString']);
- break;
- // <G_Giunta_2001-02-29>
- // Add support for encoding/decoding of booleans, since they are supported in PHP
- case 'boolean':
- $xmlrpc_val->addScalar($php_val, $GLOBALS['xmlrpcBoolean']);
- break;
- // </G_Giunta_2001-02-29>
- // catch "resource", "NULL", "user function", "unknown type"
- //case 'unknown type':
- default:
- // giancarlo pinerolo <ping@alt.it>
- // it has to return
- // an empty object in case (which is already
- // at this point), not a boolean.
- break;
- }
- return $xmlrpc_val;
- }
-
- /**
- * decode a string that is encoded w/ "chunked" transfer encoding
- * as defined in rfc2068 par. 19.4.6
- * code shamelessly stolen from nusoap library by Dietrich Ayala
- *
- * @param string $buffer the string to be decoded
- * @return string
- */
- function decode_chunked($buffer)
- {
- // length := 0
- $length = 0;
- $new = '';
-
- // read chunk-size, chunk-extension (if any) and crlf
- // get the position of the linebreak
- $chunkend = strpos($buffer,"\r\n") + 2;
- $temp = substr($buffer,0,$chunkend);
- $chunk_size = hexdec( trim($temp) );
- $chunkstart = $chunkend;
- // while(chunk-size > 0) {
- while($chunk_size > 0)
- {
- $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
-
- // just in case we got a broken connection
- if($chunkend == false)
- {
- $chunk = substr($buffer,$chunkstart);
- // append chunk-data to entity-body
- $new .= $chunk;
- $length += strlen($chunk);
- break;
- }
-
- // read chunk-data and crlf
- $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
- // append chunk-data to entity-body
- $new .= $chunk;
- // length := length + chunk-size
- $length += strlen($chunk);
- // read chunk-size and crlf
- $chunkstart = $chunkend + 2;
-
- $chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
- if($chunkend == false)
- {
- break; //just in case we got a broken connection
- }
- $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
- $chunk_size = hexdec( trim($temp) );
- $chunkstart = $chunkend;
- }
- return $new;
- }
-
- /**
- * Given a string defining a php type or phpxmlrpc type (loosely defined: strings
- * accepted come from javadoc blocks), return corresponding phpxmlrpc type.
- * NB: for php 'resource' types returns empty string, since resources cannot be serialized;
- * for php class names returns 'struct', since php objects can be serialized as xmlrpc structs
- * @param string $phptype
- * @return string
- */
- function php_2_xmlrpc_type($phptype)
- {
- switch(strtolower($phptype))
- {
- case 'string':
- return $GLOBALS['xmlrpcString'];
- case 'integer':
- case $GLOBALS['xmlrpcInt']: // 'int'
- case $GLOBALS['xmlrpcI4']:
- return $GLOBALS['xmlrpcInt'];
- case 'double':
- return $GLOBALS['xmlrpcDouble'];
- case 'boolean':
- return $GLOBALS['xmlrpcBoolean'];
- case 'array':
- return $GLOBALS['xmlrpcArray'];
- case 'object':
- return $GLOBALS['xmlrpcStruct'];
- case $GLOBALS['xmlrpcBase64']:
- case $GLOBALS['xmlrpcStruct']:
- return strtolower($phptype);
- case 'resource':
- return '';
- default:
- if(class_exists($phptype))
- {
- return $GLOBALS['xmlrpcStruct'];
- }
- else
- {
- // unknown: might be any xmlrpc type
- return $GLOBALS['xmlrpcValue'];
- }
- }
- }
-
- /**
- * Given a user-defined PHP function, create a PHP 'wrapper' function that can
- * be exposed as xmlrpc method from an xmlrpc_server object and called from remote
- * clients.
- *
- * Since php is a typeless language, to infer types of input and output parameters,
- * it relies on parsing the javadoc-style comment block associated with the given
- * function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64)
- * in the @param tag is also allowed, if you need the php function to receive/send
- * data in that particular format (note that base64 enncoding/decoding is transparently
- * carried out by the lib, while datetime vals are passed around as strings)
- *
- * Known limitations:
- * - requires PHP 5.0.3 +
- * - only works for user-defined functions, not for PHP internal functions
- * (reflection does not support retrieving number/type of params for those)
- * - functions returning php objects will generate special xmlrpc responses:
- * when the xmlrpc decoding of those responses is carried out by this same lib, using
- * the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt.
- * In short: php objects can be serialized, too (except for their resource members),
- * using this function.
- * Other libs might choke on the very same xml that will be generated in this case
- * (i.e. it has a nonstandard attribute on struct element tags)
- * - usage of javadoc @param tags using param names in a different order from the
- * function prototype is not considered valid (to be fixed?)
- *
- * Note that since rel. 2.0RC3 the preferred method to have the server call 'standard'
- * php functions (ie. functions not expecting a single xmlrpcmsg obj as parameter)
- * is by making use of the functions_parameters_type class member.
- *
- * @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') might be ok too, in the future...
- * @return false on error, or an array containing the name of the new php function,
- * its signature and docs, to be used in the server dispatch map
- *
- * @todo decide how to deal with params passed by ref: bomb out or allow?
- * @todo finish using javadoc info to build method sig if all params are named but out of order
- * @done switch to some automagic object encoding scheme
- * @todo add a check for params of 'resource' type
- * @todo add some trigger_errors when returning false?
- * @todo what to do when the PHP function returns NULL? we are currently returning bogus responses!!!
- */
- function wrap_php_function($funcname, $newfuncname='')
- {
- if(version_compare(phpversion(), '5.0.3') == -1)
- {
- // up to php 5.0.3 some useful reflection methods were missing
- return false;
- }
- if((is_array($funcname) && !method_exists($funcname[0], $funcname[1])) || !function_exists($funcname))
- {
- return false;
- }
- else
- {
- // determine name of new php function
- if($newfuncname == '')
- {
- if(is_array($funcname))
- {
- $xmlrpcfuncname = "xmlrpc_".implode('_', $funcname);
- }
- else
- {
- $xmlrpcfuncname = "xmlrpc_$funcname";
- }
- }
- else
- {
- $xmlrpcfuncname = $newfuncname;
- }
- while(function_exists($xmlrpcfuncname))
- {
- $xmlrpcfuncname .= 'x';
- }
- $code = "function $xmlrpcfuncname(\$msg) {\n";
-
- // start to introspect PHP code
- $func =& new ReflectionFunction($funcname);
- if($func->isInternal())
- {
- // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
- // instead of getparameters to fully reflect internal php functions ?
- return false;
- }
-
- // retrieve parameter names, types and description from javadoc comments
-
- // function description
- $desc = '';
- // type of return val: by default 'any'
- $returns = $GLOBALS['xmlrpcValue'];
- // type + name of function parameters
- $paramDocs = array();
-
- $docs = $func->getDocComment();
- if($docs != '')
- {
- $docs = explode("\n", $docs);
- $i = 0;
- foreach($docs as $doc)
- {
- $doc = trim($doc, " \r\t/*");
- if(strlen($doc) && strpos($doc, '@') !== 0 && !$i)
- {
- if($desc)
- {
- $desc .= "\n";
- }
- $desc .= $doc;
- }
- elseif(strpos($doc, '@param') === 0)
- {
- // syntax: @param type [$name] desc
- if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
- {
- if(strpos($matches[1], '|'))
- {
- //$paramDocs[$i]['type'] = explode('|', $matches[1]);
- $paramDocs[$i]['type'] = 'mixed';
- }
- else
- {
- $paramDocs[$i]['type'] = $matches[1];
- }
- $paramDocs[$i]['name'] = trim($matches[2]);
- $paramDocs[$i]['doc'] = $matches[3];
- }
- $i++;
- }
- elseif(strpos($doc, '@return') === 0)
- {
- $returns = preg_split("/\s+/", $doc);
- if(isset($returns[1]))
- {
- $returns = php_2_xmlrpc_type($returns[1]);
- }
- }
- }
- }
-
- // start introspection of actual function prototype and building of PHP code
- // to be eval'd
- $params = $func->getParameters();
-
- $innercode = '';
- $i = 0;
- $parsvariations = array();
- $pars = array();
- $pnum = count($params);
- foreach($params as $param)
- {
- if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != '$'.strtolower($param->getName()))
- {
- // param name from phpdoc info does not match param definition!
- $paramDocs[$i]['type'] = 'mixed';
- }
-
- if($param->isOptional())
- {
- // this particular parameter is optional. save as valid previous list of parameters
- $innercode .= "if (\$paramcount > $i) {\n";
- $parsvariations[] = $pars;
- }
- $innercode .= "\$p$i = \$msg->getParam($i);\n";
- $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_xmlrpc_decode(\$p$i);\n";
- $pars[] = "\$p$i";
- $i++;
- if($param->isOptional())
- {
- $innercode .= "}\n";
- }
- if($i == $pnum)
- {
- // last allowed parameters combination
- $parsvariations[] = $pars;
- }
- }
-
- $sigs = array();
- if(count($parsvariations) == 0)
- {
- // only known good synopsis = no parameters
- $parsvariations[] = array();
- $minpars = 0;
- }
- else
- {
- $minpars = count($parsvariations[0]);
- }
-
- if($minpars)
- {
- // add to code the check for min params number
- // NB: this check needs to be done BEFORE decoding param values
- $innercode = "\$paramcount = \$msg->getNumParams();\n" .
- "if (\$paramcount < $minpars) return new xmlrpcresp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
- }
- else
- {
- $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
- }
-
- $innercode .= "\$np = false;";
- foreach($parsvariations as $pars)
- {
- $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = $funcname(" . implode(',', $pars) . "); else\n";
- // build a 'generic' signature (only use an appropriate return type)
- $sig = array($returns);
- for($i=0; $i < count($pars); $i++)
- {
- if (isset($paramDocs[$i]['type']))
- {
- $sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
- }
- else
- {
- $sig[] = $GLOBALS['xmlrpcValue'];
- }
- }
- $sigs[] = $sig;
- }
- $innercode .= "\$np = true;\n";
- $innercode .= "if (\$np) return new xmlrpcresp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else\n";
- //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n";
- if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
- {
- $innercode .= "return new xmlrpcresp(new xmlrpcval(\$retval, '$returns'));";
- }
- else
- {
- $innercode .= "return new xmlrpcresp(php_xmlrpc_encode(\$retval, array('encode_php_objs')));";
- }
- // shall we exclude functions returning by ref?
- // if($func->returnsReference())
- // return false;
- $code = $code . $innercode . "\n}\n \$allOK=1;";
- //print_r($code);
- $allOK = 0;
- eval($code);
- // alternative
- //$xmlrpcfuncname = create_function('$m', $innercode);
-
- if(!$allOK)
- {
- return false;
- }
-
- /// @todo examine if $paramDocs matches $parsvariations and build array for
- /// usage as method signature, plus put together a nice string for docs
-
- $ret = array('function' => $xmlrpcfuncname, 'signature' => $sigs, 'docstring' => $desc);
- return $ret;
- }
- }
-
- /**
- * Given an xmlrpc client and a method name, register a php wrapper function
- * that will call it and return results using native php types for both
- * params and results. The generated php function will return an xmlrpcresp
- * oject for failed xmlrpc calls
- *
- * Known limitations:
- * - server must support system.methodsignature for the wanted xmlrpc method
- * - for methods that expose many signatures, only one can be picked (we
- * could in priciple check if signatures differ only by number of params
- * and not by type, but it would be more complication than we can spare time)
- * - nested xmlrpc params: the caller of the generated php function has to
- * encode on its own the params passed to the php function if these are structs
- * or arrays whose (sub)members include values of type datetime or base64
- *
- * Notes: the connection properties of the given client will be copied
- * and reused for the connection used during the call to the generated
- * php function.
- * Calling the generated php function 'might' be slow: a new xmlrpc client
- * is created on every invocation and an xmlrpc-connection opened+closed.
- * An extra 'debug' param is appended to param list of xmlrpc method, useful
- * for debugging purposes.
- *
- * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server
- * @param string $methodname the xmlrpc method to be mapped to a php function
- * @param integer $signum the index of the method signature to use in mapping (if method exposes many sigs)
- * @return string the name of the generated php function (or false)
- */
- function wrap_xmlrpc_method($client, $methodname, $signum=0, $timeout=0, $protocol='', $newfuncname='')
- {
- $msg =& new xmlrpcmsg('system.methodSignature');
- $msg->addparam(new xmlrpcval($methodname));
- $response =& $client->send($msg, $timeout, $protocol);
- if(!$response || $response->faultCode())
- {
- return false;
- }
- else
- {
- $desc = $response->value();
- if($desc->kindOf() != 'array' || $desc->arraysize() <= $signum)
- {
- return false;
- }
- else
- {
- if($newfuncname != '')
- {
- $xmlrpcfuncname = $newfuncname;
- }
- else
- {
- $xmlrpcfuncname = 'xmlrpc_'.str_replace('.', '_', $methodname);
- }
- while(function_exists($xmlrpcfuncname))
- {
- $xmlrpcfuncname .= 'x';
- }
- $desc = $desc->arraymem($signum);
- $code = "function $xmlrpcfuncname (";
- $innercode = "\$client =& new xmlrpc_client('$client->path', '$client->server');\n";
- // copy all client fields to the client that will be generated runtime
- // (this provides for future expansion of client obj)
- foreach($client as $fld => $val)
- {
- if($fld != 'debug' && $fld != 'return_type')
- {
- $val = var_export($val, true);
- $innercode .= "\$client->$fld = $val;\n";
- }
- }
- $innercode .= "\$client->setDebug(\$debug);\n";
- $innercode .= "\$client->return_type = 'xmlrpcvals';\n";
- $innercode .= "\$msg =& new xmlrpcmsg('$methodname');\n";
-
- // param parsing
- $plist = array();
- $pcount = $desc->arraysize();
- for($i = 1; $i < $pcount; $i++)
- {
- $plist[] = "\$p$i";
- $ptype = $desc->arraymem($i);
- $ptype = $ptype->scalarval();
- if($ptype == 'dateTime.iso8601' || $ptype == 'base64')
- {
- $innercode .= "\$p$i =& new xmlrpcval(\$p$i, '$ptype');\n";
- }
- else
- {
- $innercode .= "\$p$i =& php_xmlrpc_encode(\$p$i);\n";
- }
- $innercode .= "\$msg->addparam(\$p$i);\n";
- }
- $plist[] = '$debug = 0';
- $plist = implode(',', $plist);
-
- $innercode .= "\$res =& \$client->send(\$msg, $timeout, '$protocol');\n";
- $innercode .= "if (\$res->faultcode()) return \$res; else return php_xmlrpc_decode(\$res->value(), array('decode_php_objs'));";
-
- $code = $code . $plist. ") {\n" . $innercode . "\n}\n\$allOK=1;";
- //print_r($code);
- $allOK = 0;
- eval($code);
- // alternative
- //$xmlrpcfuncname = create_function('$m', $innercode);
- if($allOK)
- {
- return $xmlrpcfuncname;
- }
- else
- {
- return false;
- }
- }
- }
- }
-
- /**
- * xml charset encoding guessing helper function.
- * Tries to determine the charset encoding of an XML chunk
- * received over HTTP.
-
- * NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,
-
- * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
-
- * which will be most probably using UTF-8 anyway...
- *
- * @param string $httpheaders the http Content-type header
- * @param string $xmlchunk xml content buffer
- * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
- *
- * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
- */
- function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
- {
- // discussion: see http://www.yale.edu/pclt/encoding/
- // 1 - test if encoding is specified in HTTP HEADERS
-
- //Details:
- // LWS: (\13\10)?( |\t)+
- // token: (any char but excluded stuff)+
- // header: Content-type = ...; charset=value(; ...)*
- // where value is of type token, no LWS allowed between 'charset' and value
- // Note: we do not check for invalid chars in VALUE:
- // this had better be done using pure ereg as below
-
- /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
- if(eregi(";((\\xD\\xA)?[ \\x9]+)*charset=", $httpheader))
- {
- /// @BUG if charset is received uppercase, this line will fail!
- $in = strpos($httpheader, 'charset=')+8;
- $out = strpos($httpheader, ';', $in) ? strpos($httpheader, ';', $in) : strlen($httpheader);
- return strtoupper(trim(substr($httpheader, $in, $out-$in)));
- }
-
- // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern
- // (source: http://www.w3.org/TR/2000/REC-xml-20001006)
- // NOTE: actually, according to the spec, even if we find the BOM and determine
- // an encoding, we should check if there is an encoding specified
- // in the xml declaration, and verify if they match.
- /// @todo implement check as described above?
- /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
- if(@ereg("^(\\x00\\x00\\xFE\\xFF|\\xFF\\xFE\\x00\\x00|\\x00\\x00\\xFF\\xFE|\\xFE\\xFF\\x00\\x00)", $xmlchunk))
- // if (preg_match("/^(\\x00\\x00\\xFE\\xFF|\\xFF\\xFE\\x00\\x00|\\x00\\x00\\xFF\\xFE|\\xFE\\xFF\\x00\\x00)/", $xmlchunk))
- {
- return 'UCS-4';
- }
- elseif(ereg("^(\\xFE\\xFF|\\xFF\\xFE)", $xmlchunk))
- {
- return 'UTF-16';
- }
- elseif(ereg("^(\\xEF\\xBB\\xBF)", $xmlchunk))
- {
- return 'UTF-8';
- }
-
- // 3 - test if encoding is specified in the xml declaration
- // Details:
- // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
- // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
- if (ereg("^<\?xml".
- "[ \\x9\\xD\\xA]+" . "version" . "[ \\x9\\xD\\xA]*=[ \\x9\\xD\\xA]*" . "((\"[a-zA-Z0-9_.:-]+\")|('[a-zA-Z0-9_.:-]+'))".
- "[ \\x9\\xD\\xA]+" . "encoding" . "[ \\x9\\xD\\xA]*=[ \\x9\\xD\\xA]*" . "((\"[A-Za-z][A-Za-z0-9._-]*\")|('[A-Za-z][A-Za-z0-9._-]*'))",
- $xmlchunk, $regs))
- {
- return strtoupper(substr($regs[4], 1, strlen($regs[4])-2));
- }
-
- // 4 - if mbstring is available, let it do the guesswork
- // NB: we favour finding an encoding that is compatible with what we can process
- if(extension_loaded('mbstring'))
- {
- if($encoding_prefs)
- {
- $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
- }
- else
- {
- $enc = mb_detect_encoding($xmlchunk);
- }
- // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
- // IANA also likes better US-ASCII, so go with it
- if($enc == 'ASCII')
- {
- $enc = 'US-'.$enc;
- }
- return $enc;
- }
- else
- {
- // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
- // Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types
- // this should be the standard. And we should be getting text/xml as request and response.
- // BUT we have to be backward compatible with the lib, which always used UTF-8 as default...
- return $GLOBALS['xmlrpc_defencoding'];
- }
- }
-
-/**
-* Checks if a given charset encoding is present in a list of encodings or
-* if it is a valid subset of any encoding in the list
-* @param string $encoding charset to be tested
-* @param mixed $validlist comma separated list of valid charsets (or array of charsets)
-*/
-function is_valid_charset($encoding, $validlist)
-{
- $charset_supersets = array(
- 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
- 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
- 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
- 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
- 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
- );
- if (is_string($validlist))
- $validlist = split(',', $validlist);
- if (@in_array(strtoupper($encoding), $validlist))
- return true;
- else
- {
- if (array_key_exists($encoding, $charset_supersets))
- foreach ($validlist as $allowed)
- if (in_array($allowed, $charset_supersets[$encoding]))
- return true;
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/addons/esale_osc/connector/xmlrpcs.inc b/addons/esale_osc/connector/xmlrpcs.inc
deleted file mode 100644
index c7a9da90a10..00000000000
--- a/addons/esale_osc/connector/xmlrpcs.inc
+++ /dev/null
@@ -1,1040 +0,0 @@
-<?php
-// by Edd Dumbill (C) 1999-2002
-// <edd@usefulinc.com>
-// $Id: xmlrpcs.inc,v 1.52 2006/01/19 23:48:58 ggiunta Exp $
-
-// Copyright (c) 1999,2000,2002 Edd Dumbill.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// * Neither the name of the "XML-RPC for PHP" nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
- // XML RPC Server class
- // requires: xmlrpc.inc
-
- // listMethods: signature was either a string, or nothing.
- // The useless string variant has been removed
- $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));
- $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
- function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
- {
-
- $outAr=array();
- foreach($server->dmap as $key => $val)
- {
- $outAr[]=&new xmlrpcval($key, 'string');
- }
- if($server->allow_system_funcs)
- {
- foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)
- {
- $outAr[]=&new xmlrpcval($key, 'string');
- }
- }
- $v=&new xmlrpcval($outAr, 'array');
- return new xmlrpcresp($v);
- }
-
- $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString']));
- $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
- function _xmlrpcs_methodSignature($server, $m)
- {
- // let accept as parameter both an xmlrpcval or string
- if (is_object($m))
- {
- $methName=$m->getParam(0);
- $methName=$methName->scalarval();
- }
- else
- {
- $methName=$m;
- }
- if(ereg("^system\.", $methName))
- {
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
- }
- else
- {
- $dmap=$server->dmap; $sysCall=0;
- }
- // print "<!-- ${methName} -->\n";
- if(isset($dmap[$methName]))
- {
- if(isset($dmap[$methName]['signature']))
- {
- $sigs=array();
- foreach($dmap[$methName]['signature'] as $inSig)
- {
- $cursig=array();
- foreach($inSig as $sig)
- {
- $cursig[]=&new xmlrpcval($sig, 'string');
- }
- $sigs[]=&new xmlrpcval($cursig, 'array');
- }
- $r=&new xmlrpcresp(new xmlrpcval($sigs, 'array'));
- }
- else
- {
- // NB: according to the official docs, we should be returning a
- // "none-array" here, which means not-an-array
- $r=&new xmlrpcresp(new xmlrpcval('undef', 'string'));
- }
- }
- else
- {
- $r=&new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
- }
- return $r;
- }
-
- $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
- $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
- function _xmlrpcs_methodHelp($server, $m)
- {
- // let accept as parameter both an xmlrpcval or string
- if (is_object($m))
- {
- $methName=$m->getParam(0);
- $methName=$methName->scalarval();
- }
- else
- {
- $methName=$m;
- }
- if(ereg("^system\.", $methName))
- {
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
- }
- else
- {
- $dmap=$server->dmap; $sysCall=0;
- }
- // print "<!-- ${methName} -->\n";
- if(isset($dmap[$methName]))
- {
- if(isset($dmap[$methName]['docstring']))
- {
- $r=&new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
- }
- else
- {
- $r=&new xmlrpcresp(new xmlrpcval('', 'string'));
- }
- }
- else
- {
- $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
- }
- return $r;
- }
-
- $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray']));
- $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
-
- function _xmlrpcs_multicall_error($err)
- {
- if(is_string($err))
- {
- $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];
- $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];
- }
- else
- {
- $code = $err->faultCode();
- $str = $err->faultString();
- }
- $struct = array();
- $struct['faultCode'] =& new xmlrpcval($code, 'int');
- $struct['faultString'] =& new xmlrpcval($str, 'string');
- return new xmlrpcval($struct, 'struct');
- }
-
- function _xmlrpcs_multicall_do_call($server, $call)
- {
- if($call->kindOf() != 'struct')
- {
- return _xmlrpcs_multicall_error('notstruct');
- }
- $methName = @$call->structmem('methodName');
- if(!$methName)
- {
- return _xmlrpcs_multicall_error('nomethod');
- }
- if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')
- {
- return _xmlrpcs_multicall_error('notstring');
- }
- if($methName->scalarval() == 'system.multicall')
- {
- return _xmlrpcs_multicall_error('recursion');
- }
-
- $params = @$call->structmem('params');
- if(!$params)
- {
- return _xmlrpcs_multicall_error('noparams');
- }
- if($params->kindOf() != 'array')
- {
- return _xmlrpcs_multicall_error('notarray');
- }
- $numParams = $params->arraysize();
-
- $msg =& new xmlrpcmsg($methName->scalarval());
- for($i = 0; $i < $numParams; $i++)
- {
- if(!$msg->addParam($params->arraymem($i)))
- {
- $i++;
- return _xmlrpcs_multicall_error(new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['incorrect_params'],
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i));
- }
- }
-
- $result = $server->execute($msg);
-
- if($result->faultCode() != 0)
- {
- return _xmlrpcs_multicall_error($result); // Method returned fault.
- }
-
- return new xmlrpcval(array($result->value()), 'array');
- }
-
- function _xmlrpcs_multicall_do_call_phpvals($server, $call)
- {
- if(!is_array($call))
- {
- return _xmlrpcs_multicall_error('notstruct');
- }
- if(!array_key_exists('methodName', $call))
- {
- return _xmlrpcs_multicall_error('nomethod');
- }
- if (!is_string($call['methodName']))
- {
- return _xmlrpcs_multicall_error('notstring');
- }
- if($call['methodName'] == 'system.multicall')
- {
- return _xmlrpcs_multicall_error('recursion');
- }
- if(!array_key_exists('params', $call))
- {
- return _xmlrpcs_multicall_error('noparams');
- }
- if(!is_array($call['params']))
- {
- return _xmlrpcs_multicall_error('notarray');
- }
-
- // this is a real dirty and simplistic hack, since we might have received a
- // base64 or datetime values, but they will be listed as strings here...
- $numParams = count($call['params']);
- $pt = array();
- foreach($call['params'] as $val)
- $pt[] = php_2_xmlrpc_type(gettype($val));
-
- $result = $server->execute($call['methodName'], $call['params'], $pt);
-
- if($result->faultCode() != 0)
- {
- return _xmlrpcs_multicall_error($result); // Method returned fault.
- }
-
- return new xmlrpcval(array($result->value()), 'array');
- }
-
- function _xmlrpcs_multicall($server, $m)
- {
- $result = array();
- // let accept a plain list of php parameters, beside a single xmlrpc msg object
- if (is_object($m))
- {
- $calls = $m->getParam(0);
- $numCalls = $calls->arraysize();
- for($i = 0; $i < $numCalls; $i++)
- {
- $call = $calls->arraymem($i);
- $result[$i] = _xmlrpcs_multicall_do_call($server, $call);
- }
- }
- else
- {
- //$calls = func_get_args();
- $numCalls=count($m);
- for($i = 0; $i < $numCalls; $i++)
- {
- $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);
- }
- }
-
- return new xmlrpcresp(new xmlrpcval($result, 'array'));
- }
-
- $GLOBALS['_xmlrpcs_dmap']=array(
- 'system.listMethods' => array(
- 'function' => '_xmlrpcs_listMethods',
- 'signature' => $_xmlrpcs_listMethods_sig,
- 'docstring' => $_xmlrpcs_listMethods_doc),
- 'system.methodHelp' => array(
- 'function' => '_xmlrpcs_methodHelp',
- 'signature' => $_xmlrpcs_methodHelp_sig,
- 'docstring' => $_xmlrpcs_methodHelp_doc),
- 'system.methodSignature' => array(
- 'function' => '_xmlrpcs_methodSignature',
- 'signature' => $_xmlrpcs_methodSignature_sig,
- 'docstring' => $_xmlrpcs_methodSignature_doc),
- 'system.multicall' => array(
- 'function' => '_xmlrpcs_multicall',
- 'signature' => $_xmlrpcs_multicall_sig,
- 'docstring' => $_xmlrpcs_multicall_doc
- )
- );
-
- $GLOBALS['_xmlrpcs_occurred_errors'] = '';
- $GLOBALS['_xmlrpcs_prev_ehandler'] = '';
- /**
- * Error handler used to track errors that occur during server-side execution of PHP code.
- * This allows to report back to the client whether an internal error has occurred or not
- * using an xmlrpc response object, instead of letting the client deal with the html junk
- * that a PHP execution error on the server generally entails.
- *
- * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
- *
- */
- function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
- {
- //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
- if($errcode != 2048) // do not use E_STRICT by name, since on PHP 4 it will not be defined
- {
- $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";
- }
- // Try to avoid as much as possible disruption to the previous error handling
- // mechanism in place
- if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')
- {
- // The previous error handler was the default: all we should do is log error
- // to teh default error log (if level high enough)
- if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode))
- {
- error_log($errstring);
- }
- }
- else
- {
- // Pass control on to previous error handler, trying to avoid loops...
- if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
- {
- // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers
- if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))
- {
- $GLOBALS['_xmlrpcs_prev_ehandler'][0]->$GLOBALS['_xmlrpcs_prev_ehandler'][1]($errcode, $errstring, $filename, $lineno, $context);
- }
- else
- {
- $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
- }
- }
- }
- }
-
- $GLOBALS['_xmlrpc_debuginfo']='';
-
- /**
- * Add a string to the debug info that can be later seralized by the server
- * as part of the response message.
- * Note that for best compatbility, the debug string should be encoded using
- * the $GLOBALS['xmlrpc_internalencoding'] character set.
- * @param string $m
- * @access public
- */
- function xmlrpc_debugmsg($m)
- {
- $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";
- }
-
- class xmlrpc_server
- {
- /// array defining php functions exposed as xmlrpc methods by this server
- var $dmap=array();
- /**
- * Defines how functions in dmap will be invokde: either using an xmlrpc msg object
- * or plain php values.
- * valid strings are 'xmlrpcvals' or 'phpvals'
- */
- var $functions_parameters_type='xmlrpcvals';
- /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3
- var $debug = 1;
- /**
- * When set to true, it will enable HTTP compression of the response, in case
- * the client has declared its support for compression in the request.
- */
- var $compress_response = false;
- /**
- * List of http compression methods accepted by the server for requests.
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
- */
- var $accepted_compression = array();
- /// shall we serve calls to system.* methods?
- var $allow_system_funcs = true;
- /// list of charset encodings natively accepted for requests
- var $accepted_charset_encodings = array();
- /**
- * charset encoding to be used for response.
- * NB: if we can, we will convert the generated response from internal_encoding to the intended one.
- * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled),
- * null (leave unspecified in response, convert output stream to US_ASCII),
- * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert outpt stream if needed),
- * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway).
- * NB: pretty dangerous if you accept every charset and do not have mbstring enabled)
- */
- var $response_charset_encoding = '';
- var $xml_header = "<?xml version=\"1.0\" ?>\n";
- /// storage for internal debug info
- var $debug_info = '';
-
- /**
- * @param array $dispmap the dispatch map withd efinition of exposed services
- * @param boolean $servicenow set to false to prevent the server from runnung upon construction
- */
- function xmlrpc_server($dispMap=null, $serviceNow=true)
- {
- // if ZLIB is enabled, let the server by default accept compressed requests,
- // and compress responses sent to clients that support them
- if(function_exists('gzinflate'))
- {
- $this->accepted_compression = array('gzip', 'deflate');
- $this->compress_response = true;
- }
-
- // by default the xml parser can support these 3 charset encodings
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
-
- // dispMap is a dispatch array of methods
- // mapped to function names and signatures
- // if a method
- // doesn't appear in the map then an unknown
- // method error is generated
- /* milosch - changed to make passing dispMap optional.
- * instead, you can use the class add_to_map() function
- * to add functions manually (borrowed from SOAPX4)
- */
- if($dispMap)
- {
- $this->dmap = $dispMap;
- if($serviceNow)
- {
- $this->service();
- }
- }
- }
-
- /**
- * Set debug level of server.
- * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments)
- * 0 = no debug info,
- * 1 = msgs set from user with debugmsg(),
- * 2 = add complete xmlrpc request (headers and body),
- * 3 = add also all processing warnings happened during method processing
- * (NB: this involves setting a custom error handler, and might interfere
- * with the standard processing of the php function exposed as method. In
- * particular, triggering an USER_ERROR level error will not halt script
- * execution anymore, but just end up logged in the xmlrpc response)
- * Note that info added at elevel 2 and 3 will be base64 encoded
- */
- function setDebug($in)
- {
- $this->debug=$in;
- }
-
- /**
- * Return a string with the serialized representation of all debug info
- * @param string $charset_encoding the target charset encoding for the serialization
- * @return string an XML comment (or two)
- */
- function serializeDebug($charset_encoding='')
- {
- // Tough encoding problem: which internal charset should we assume for debug info?
- // It might contain a copy of raw data received from client, ie with unknown encoding,
- // intermixed with php generated data and user generated data...
- // so we split it: system debug is base 64 encoded,
- // user debug info should be encoded by the end user using the INTERNAL_ENCODING
- $out = '';
- if ($this->debug_info != '') {
- $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
- }
- if($GLOBALS['_xmlrpc_debuginfo']!='')
- {
-
- $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
- // NB: a better solution MIGHT be to use CDATA, but we need to insert it
- // into return payload AFTER the beginning tag
- //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
- }
- return $out;
- }
-
- /**
- * Execute the xmlrpc request, printing the response
- * @param string $data the request body. If null, the http POST request will be examined
- */
- function service($data=null)
- {
- if ($data === null) {
- $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
- }
-
- // reset internal debug info
- $this->debug_info = '';
-
- // Echo back what we received, before parsing it
- if($this->debug > 1)
- {
- $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
- }
-
- $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding);
- if (!$r)
- {
- $r=$this->parseRequest($data, $req_charset);
- }
-
- if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors'])
- {
- $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
- $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++");
- }
-
- //$payload='<?xml version="1.0" encoding="' . $GLOBALS['xmlrpc_defencoding'] . '"?' . '>' . "\n"
- $payload=$this->xml_header;
- if($this->debug > 0)
- {
-
- //$payload = $payload . "<methodResponse>\n" . $this->serializeDebug();
- //$payload = $payload . substr($r->serialize(), 17);
- $payload = $payload . $this->serializeDebug($resp_charset);
- }
- //else
- //{
- $payload = $payload . $r->serialize($resp_charset);
- //}
-
-
- // if we get a warning/error that has output some text before here, then we cannot
- // add a new header. We cannot say we are sending xml, either...
- if(!headers_sent())
- {
- header('Content-Type: '.$r->content_type);
- // we do not know if client actually told us an accepted charset, but if he did
- // we have to tell him what we did
- header("Vary: Accept-Charset");
-
- // http compression of output
- if($this->compress_response && function_exists('gzencode') && $resp_encoding != '')
- {
- if(strstr($resp_encoding, 'gzip'))
- {
- $payload = gzencode($payload);
- header("Content-Encoding: gzip");
- header("Vary: Accept-Encoding");
- }
- elseif (strstr($resp_encoding, 'deflate'))
- {
- $payload = gzdeflate($payload);
- header("Content-Encoding: deflate");
- header("Vary: Accept-Encoding");
- }
- }
-
- header('Content-Length: ' . (int)strlen($payload));
- }
- else
- {
- //print "Internal server error: headers sent before PHP response"
- }
-
- print $payload;
- }
-
- /**
- * Add a method to the dispatch map
- * @param string $methodname the name with which the method will be made available
- * @param string $function the php function that will get invoked
- * @param array $sig the array of valid method signatures
- * @param string $doc method documentation
- */
- function add_to_map($methodname,$function,$sig,$doc='')
- {
- $this->dmap[$methodname] = array(
- 'function' => $function,
- 'signature' => $sig,
- 'docstring' => $doc
- );
- }
-
- /**
- * Verify type and number of parameters received against a list of known signatures
- * @param array $in array of either xmlrpcval objects or xmlrpc type definitions
- * @param array $sig array of known signatures to match against
- * @access private
- */
- function verifySignature($in, $sig)
- {
- // check each possible signature in turn
- if (is_object($in))
- {
- $numParams = $in->getNumParams();
- }
- else
- {
- $numParams = sizeof($in);
- }
- foreach($sig as $cursig)
- {
- if(sizeof($cursig)==$numParams+1)
- {
- $itsOK=1;
- for($n=0; $n<$numParams; $n++)
- {
- if (is_object($in))
- {
- $p=$in->getParam($n);
- if($p->kindOf() == 'scalar')
- {
- $pt=$p->scalartyp();
- }
- else
- {
- $pt=$p->kindOf();
- }
- }
- else
- {
- $pt= $in[$n] == 'i4' ? 'int' : $in[$n]; // dispatch maps never use i4...
- }
-
- // param index is $n+1, as first member of sig is return type
- if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue'])
- {
- $itsOK=0;
- $pno=$n+1;
- $wanted=$cursig[$n+1];
- $got=$pt;
- break;
- }
- }
- if($itsOK)
- {
- return array(1,'');
- }
- }
- }
- if(isset($wanted))
- {
- return array(0, "Wanted ${wanted}, got ${got} at param ${pno}");
- }
- else
- {
- return array(0, "No method signature matches number of parameters");
- }
- }
-
- /**
- * Parse http headers received along with xmlrpc request. If needed, inflate request
- * @return null on success or an xmlrpcresp
- * @access private
- */
- function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression)
- {
- // Play nice to PHP 4.0.x: superglobals were not yet invented...
- if(!isset($_SERVER))
- {
- $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
- }
-
- if($this->debug > 1)
- {
- if(function_exists('getallheaders'))
- {
- $this->debugmsg(''); // empty line
- foreach(getallheaders() as $name => $val)
- {
- $this->debugmsg("HEADER: $name: $val");
- }
- }
-
- }
-
- if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
- {
- $content_encoding = $_SERVER['HTTP_CONTENT_ENCODING'];
- }
- else
- {
- $content_encoding = '';
- }
-
- // check if request body has been compressed and decompress it
- if($content_encoding != '' && strlen($data))
- {
- if($content_encoding == 'deflate' || $content_encoding == 'gzip')
- {
- // if decoding works, use it. else assume data wasn't gzencoded
- if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression))
- {
- if($content_encoding == 'deflate' && $degzdata = @gzinflate($data))
- {
- $data = $degzdata;
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
- }
- }
- elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
- {
- $data = $degzdata;
- if($this->debug > 1)
- $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
- }
- else
- {
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
- return $r;
- }
- }
- else
- {
- //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
- $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
- return $r;
- }
- }
- }
-
- // check if client specified accepted charsets, and if we know how to fulfill
- // the request
- if ($this->response_charset_encoding == 'auto')
- {
- $resp_encoding = '';
- if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))
- {
- // here we should check if we can match the client-requested encoding
- // with the encodings we know we can generate.
- /// @todo we should parse q=0.x preferences instead of getting first charset specified...
- $client_accepted_charsets = split(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
- // Give preference to internal encoding
- $known_charsets = array($this->internal_encoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');
- foreach ($known_charsets as $charset)
- {
- foreach ($client_accepted_charsets as $accepted)
- if (strpos($accepted, $charset) === 0)
- {
- $resp_encoding = $charset;
- break;
- }
- if ($resp_encoding)
- break;
- }
- }
- }
- else
- {
-
- $resp_encoding = $this->response_charset_encoding;
- }
-
- if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
- {
- $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
- }
- else
- {
- $resp_compression = '';
- }
-
- // 'guestimate' request encoding
- /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check???
- $req_encoding = guess_encoding(isset($_SERVER['HTTP_CONTENT_TYPE']) ? $_SERVER['HTTP_CONTENT_TYPE'] : '',
- $data);
-
- return null;
- }
-
- /**
- * Parse an xml chunk containing an xmlrpc request and execute the corresponding
- * php function registered with the server
- * @param string $data the xml request
- * @param string $req_encoding (optional) the charset encoding of the xml request
- * @return xmlrpcresp
- * @access private
- */
- function parseRequest($data, $req_encoding='')
- {
- // 2005/05/07 commented and moved into caller function code
- //if($data=='')
- //{
- // $data=$GLOBALS['HTTP_RAW_POST_DATA'];
- //}
-
-
- // G. Giunta 2005/02/13: we do NOT expect to receive html entities
- // so we do not try to convert them into xml character entities
- //$data = xmlrpc_html_entity_xlate($data);
-
- $GLOBALS['_xh']=array();
- $GLOBALS['_xh']['isf']=0;
- $GLOBALS['_xh']['isf_reason']='';
- $GLOBALS['_xh']['params']=array();
- $GLOBALS['_xh']['pt']=array();
- $GLOBALS['_xh']['stack']=array();
- $GLOBALS['_xh']['valuestack'] = array();
- $GLOBALS['_xh']['method']='';
-
- // decompose incoming XML into request structure
- if ($req_encoding != '')
- {
- if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- // the following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
- //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
- {
- error_log('XML-RPC: xmlrpc_server::parseRequest: invalid charset encoding of received request: '.$req_encoding);
- $req_encoding = $GLOBALS['xmlrpc_defencoding'];
- }
- $parser = xml_parser_create($req_encoding);
- }
- else
- {
- $parser = xml_parser_create();
- }
-
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
- // the xml parser to give us back data in the expected charset
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
-
- if ($this->functions_parameters_type == 'phpvals')
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
- else
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
- xml_set_character_data_handler($parser, 'xmlrpc_cd');
- xml_set_default_handler($parser, 'xmlrpc_dh');
- if(!xml_parse($parser, $data, 1))
- {
- // return XML error as a faultCode
- $r=&new xmlrpcresp(0,
- $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),
- sprintf('XML error: %s at line %d',
- xml_error_string(xml_get_error_code($parser)),
- xml_get_current_line_number($parser)));
- xml_parser_free($parser);
- }
- elseif ($GLOBALS['_xh']['isf'])
- {
- xml_parser_free($parser);
- $r=&new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['invalid_request'],
- $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
- }
- else
- {
- xml_parser_free($parser);
- if ($this->functions_parameters_type == 'phpvals')
- {
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
- }
- $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
- }
- else
- {
- // build an xmlrpcmsg object with data parsed from xml
- $m=&new xmlrpcmsg($GLOBALS['_xh']['method']);
- // now add parameters in
- for($i=0; $i<sizeof($GLOBALS['_xh']['params']); $i++)
- {
- $m->addParam($GLOBALS['_xh']['params'][$i]);
- }
-
- if($this->debug > 1)
- {
- $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");
- }
-
- $r = $this->execute($m);
- }
- }
- return $r;
- }
-
- /**
- * Execute a method invoked by the client, checking parameters used
- * @param mixed $m either an xmlrpcmsg obj or a method name
- * @param array $params array with method parameters as php types (if m is method name only)
- * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only)
- * @return xmlrpcresp
- */
- function execute($m, $params=null, $paramtypes=null)
- {
- if (is_object($m))
- {
- $methName = $m->method();
- }
- else
- {
- $methName = $m;
- }
- $sysCall = $this->allow_system_funcs && ereg("^system\.", $methName);
- $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;
-
- if(!isset($dmap[$methName]['function']))
- {
- // No such method
- return new xmlrpcresp(0,
- $GLOBALS['xmlrpcerr']['unknown_method'],
- $GLOBALS['xmlrpcstr']['unknown_method']);
- }
-
- // Check signature
- if(isset($dmap[$methName]['signature']))
- {
- $sig = $dmap[$methName]['signature'];
- if (is_object($m))
- {
- list($ok, $errstr) = $this->verifySignature($m, $sig);
- }
- else
- {
- list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
- }
- if(!$ok)
- {
- // Didn't match.
- return new xmlrpcresp(
- 0,
- $GLOBALS['xmlrpcerr']['incorrect_params'],
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
- );
- }
- }
-
- $func = $dmap[$methName]['function'];
- // let the 'class::function' syntax be accepted in dispatch maps
- if(is_string($func) && strpos($func, '::'))
- {
- $func = explode('::', $func);
- }
- // verify that function to be invoked is in fact callable
- if(!is_callable($func))
- {
- return new xmlrpcresp(
- 0,
- $GLOBALS['xmlrpcerr']['server_error'],
- $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"
- );
- }
-
- // If debug level is 3, we should catch all errors generated during
- // processing of user function, and log them as part of response
- if($this->debug > 2)
- {
- $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');
- }
- if (is_object($m))
- {
- if($sysCall)
- {
- $r = call_user_func($func, $this, $m);
- }
- else
- {
- $r = call_user_func($func, $m);
- }
- }
- else
- {
- // call a 'plain php' function
- if($sysCall)
- {
- array_unshift($params, $this);
- $r = call_user_func_array($func,$params);
- }
- else
- {
- $r = call_user_func_array($func, $params);
- }
- // the return type can be either an xmlrpcresp object or a plain php value...
- if (!is_a($r, 'xmlrpcresp'))
- {
- // what should we assume here about automatic encoding of datetimes
- // and php classes instances???
- $r = new xmlrpcresp(php_xmlrpc_encode($r, array('auto_dates')));
- }
- }
- if($this->debug > 2)
- {
- // note: restore the error handler we found before calling the
- // user func, even if it has been changed inside the func itself
- if($GLOBALS['_xmlrpcs_prev_ehandler'])
- {
- set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
- }
- else
- {
- restore_error_handler();
- }
- }
- return $r;
- }
-
- /**
- * add a string to the 'internal debug message' (separate from 'user debug message')
- * @param string $strings
- * @access private
- */
- function debugmsg($string)
- {
- $this->debug_info .= $string."\n";
- }
-
- /**
- * A debugging routine: just echoes back the input packet as a string value
- * DEPRECATED!
- */
- function echoInput()
- {
- $r=&new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
- print $r->serialize();
- }
- }
-?> \ No newline at end of file
diff --git a/addons/esale_osc/esale_osc.py b/addons/esale_osc/esale_osc.py
deleted file mode 100644
index 4dfe0fc00f8..00000000000
--- a/addons/esale_osc/esale_osc.py
+++ /dev/null
@@ -1,217 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import netsvc
-from osv import fields,osv,orm
-import ir
-
-import time
-import xmlrpclib
-from mx import DateTime
-
-class esale_osc_web(osv.osv):
- _name = "esale_osc.web"
- _description = "OScommerce Website"
- _columns = {
- 'name': fields.char('Name',size=64, required=True),
- 'url': fields.char('URL', size=64, required=True),
- 'shop_id': fields.many2one('sale.shop', 'Sale Shop', required=True),
- 'partner_anonymous_id': fields.many2one('res.partner', 'Anonymous', required=True),
- 'active': fields.boolean('Active'),
- 'product_ids': fields.one2many('esale_osc.product', 'web_id', 'Web Products'),
- 'language_ids': fields.one2many('esale_osc.lang', 'web_id', 'Languages'),
- 'tax_ids': fields.one2many('esale_osc.tax', 'web_id', 'Taxes'),
- 'category_ids': fields.one2many('esale_osc.category', 'web_id', 'Categories'),
- }
- _defaults = {
- 'active': lambda *a: 1
- }
-
- def add_all_products(self, cr, uid, ids, *args):
- product_pool=self.pool.get('esale_osc.product')
- for id in ids:
- cr.execute("select p.id from product_product as p left join esale_osc_product as o on p.id=o.product_id and o.web_id=%d where o.id is NULL;" % id)
- for [product] in cr.fetchall():
- value={ 'product_id' : product,
- 'web_id' : id
- }
- value.update(product_pool.onchange_product_id(cr, uid, [], product, id)['value'])
- product_pool.create(cr, uid, value)
- return True
-
- def tax_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
- taxes = server.get_taxes()
- for tax in taxes:
- value={
- 'web_id' : website.id,
- 'esale_osc_id' : tax[0],
- 'name' : tax[1]
- }
- self.pool.get('esale_osc.tax').create(cr, uid, value)
- return True
-
- def lang_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
- languages = server.get_languages()
- for language in languages:
- value={ 'web_id' : website.id,
- 'esale_osc_id' : language[0],
- 'name' : language[1]
- }
- self.pool.get('esale_osc.lang').create(cr, uid, value)
- return True
-
- def category_import(self, cr, uid, ids, *args):
- for website in self.browse(cr, uid, ids):
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
- categories = server.get_categories()
- category_pool = self.pool.get('esale_osc.category')
- for category in categories:
- value={ 'web_id' : website.id,
- 'esale_osc_id' : category[0],
- 'name' : category[1]
- }
- existing = category_pool.search(cr, uid, [('web_id','=',website.id), ('esale_osc_id', '=', category[0])])
- if len(existing)>0:
- category_pool.write(cr, uid, existing, value)
- else:
- category_pool.create(cr, uid, value)
- return True
-
-esale_osc_web()
-
-class esale_osc_tax(osv.osv):
- _name = "esale_osc.tax"
- _description = "esale_osc Tax"
- _columns = {
- 'name' : fields.char('Tax name', size=32, required=True),
- 'esale_osc_id' : fields.integer('esale_osc ID'),
- 'tax_id' : fields.many2one('account.tax', 'Tax'),
- 'web_id' : fields.many2one('esale_osc.web', 'Website')
- }
-esale_osc_tax()
-
-class esale_osc_category(osv.osv):
- _name = "esale_osc.category"
- _description = "esale_osc Category"
- _columns = { 'name' : fields.char('Name', size=64, reuired=True),
- 'esale_osc_id' : fields.integer('esale_osc ID', required=True),
- 'web_id' : fields.many2one('esale_osc.web', 'Website'),
- 'category_id' : fields.many2one('product.category', 'Category'),
- }
-esale_osc_category()
-
-class esale_osc_product(osv.osv):
- _name = "esale_osc.product"
- _description = "esale_osc Product"
- _columns = { 'web_id' : fields.many2one('esale_osc.web', 'Web Ref'),
- 'name' : fields.char('Name', size=64, required=True),
- 'product_id' : fields.many2one('product.product', 'Product', required=True),
- 'esale_osc_id' : fields.integer('esale_osc product id'),
- 'esale_osc_tax_id' : fields.many2one('esale_osc.tax', 'esale_osc tax'),
- }
-
- def onchange_product_id(self, cr, uid, ids, product_id, web_id):
- value={}
- if (product_id):
- product=self.pool.get('product.product').browse(cr, uid, product_id)
- value['name']=product.name
- return {'value': value}
-esale_osc_product()
-
-class esale_osc_language(osv.osv):
- _name = "esale_osc.lang"
- _description = "esale_osc Language"
- _columns = { 'name' : fields.char('Name', size=32, required=True),
- 'esale_osc_id' : fields.integer('esale_osc ID', required=True),
- 'language_id' : fields.many2one('res.lang', 'Language'),
- 'web_id' : fields.many2one('esale_osc.web', 'Website')
- }
-esale_osc_language()
-
-class esale_osc_saleorder(osv.osv):
- _inherit='sale.order'
- _name='sale.order'
- _table='sale_order'
- _columns = {
- 'esale_osc_web': fields.many2one('esale_osc.web', 'Website'),
- 'esale_osc_id': fields.integer('esale_osc Id'),
- }
- _defaults = {
- 'esale_osc_id': lambda *a: False,
- }
-
- def onchange_esale_osc_web(self, cr, uid, ids, esale_osc_web):
- value={}
- if esale_osc_web:
- web=self.pool.get('esale_osc.web').browse(cr, uid, esale_osc_web)
- value['shop_id']=web.shop_id.id
- value['partner_id']=web.partner_anonymous_id.id
- value.update(self.pool.get('sale.order').onchange_shop_id(cr, uid, ids, value['shop_id'])['value'])
- value.update(self.pool.get('sale.order').onchange_partner_id(cr, uid, ids, value['partner_id'])['value'])
-
- return {'value':value}
-
- def order_create(self, cr, uid, ids, context={}):
- for order in self.browse(cr, uid, ids, context):
- addr = self.pool.get('res.partner').address_get(cr, uid, [order.partner_id.id], ['delivery','invoice','contact'])
- pricelist_id=order.partner_id.property_product_pricelist.id
- order_lines = []
- for line in order.order_lines:
- order_lines.append( (0,0,{
- 'name': line.name,
- 'product_qty': line.product_qty,
- 'date_planned': line.date_planned,
- 'product_id': line.product_id.id,
- 'product_uom': line.product_uom.id,
- 'price_unit': line.price_unit,
- 'type': line.product_id.procure_method
- }) )
- order_id = self.pool.get('sale.order').create(cr, uid, {
- 'name': order.name,
- 'shop_id': order.web_id.shop_id.id,
- 'origin': 'WEB:'+str(order.id),
- 'date_order': order.date_order,
- 'user_id': uid,
- 'partner_id': order.partner_id.id,
- 'partner_invoice_id':addr['invoice'],
- 'partner_order_id':addr['contact'],
- 'partner_shipping_id':addr['delivery'],
- 'pricelist_id': pricelist_id,
- 'order_line': order_lines
- })
- self.write(cr, uid, [order.id], {'state':'done', 'order_id': order_id})
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'sale.order', order_id, 'order_confirm', cr)
- return True
-
-esale_osc_saleorder()
diff --git a/addons/esale_osc/esale_osc_view.xml b/addons/esale_osc/esale_osc_view.xml
deleted file mode 100644
index e51bf68704b..00000000000
--- a/addons/esale_osc/esale_osc_view.xml
+++ /dev/null
@@ -1,201 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <menuitem name="Sales Management/Internet Sales" id="menu_esale_osc_root"/>
-
- <record model="ir.ui.view" id="view_esale_osc_form">
- <field name="name">esale_osc.web.form</field>
- <field name="model">esale_osc.web</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="esale_osc Web Shop">
- <notebook>
- <page string="General Informations">
- <separator string="esale_osc Shop Info" colspan="4"/>
- <field name="name" select="1" colspan="4"/>
- <field name="url" widget="url" required="1"/>
- <field name="active" select="1"/>
- <field name="shop_id" select="1" required="1"/>
- <field name="partner_anonymous_id" required="1"/>
- <label string="Proceed with the mappings BEFORE the definitions of the active products!!" colspan="4"/>
- <separator string="Active Products" colspan="4"/>
- <button name="add_all_products" string="Add all products" type="object"/>
- <field name="product_ids" colspan="4" view="esale_osc.product.web.form" widget="one2many_list" />
- </page>
- <page string="Taxes Mapping">
- <button type="object" string="Import Taxes" name="tax_import"/>
- <field colspan="4" name="tax_ids" widget="one2many_list" view="esale_osc.tax.web.form"/>
- </page>
- <page string="Languages Mapping">
- <button type="object" string="Import Languages" name="lang_import"/>
- <field colspan="4" name="language_ids" widget="one2many_list" view="esale_osc.language.web.form"/>
- </page>
- <page string="Categories Mapping">
- <button type="object" string="Import categories" name="category_import"/>
- <field colspan="4" name="category_ids" widget="one2many_list" view="esale_osc.category.web.form"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_esale_osc_form">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">esale_osc.web</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_esale_osc_form"/>
- </record>
-
- <menuitem name="Sales Management/Internet Sales/Websites" id="menu_action_esale_osc_web" action="action_esale_osc_form" groups="admin"/>
-
- <record model="ir.ui.view" id="esale_osc_language_web_form">
- <field name="name">esale_osc.language.web.form</field>
- <field name="model">esale_osc.lang</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Language">
- <separator colspan="4" string="Language mapping"/>
- <field colspan="4" name="name" select="1" required="1"/>
- <field name="language_id" select="1"/>
- <field name="esale_osc_id" readonly="1" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="esale_osc_tax_web_form">
- <field name="name">esale_osc.tax.web.form</field>
- <field name="model">esale_osc.tax</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Taxes">
- <separator colspan="4" string="Taxes mapping"/>
- <field colspan="4" name="name" select="1" required="1"/>
- <field name="tax_id" select="1"/>
- <field name="esale_osc_id" readonly="1" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="esale_osc_category_web_form">
- <field name="name">esale_osc.category.web.form</field>
- <field name="model">esale_osc.category</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Categories">
- <separator colspan="4" string="taxes"/>
- <field name="name" select="1" colspan="4" required="1"/>
- <field name="category_id" select="1"/>
- <field name="esale_osc_id" select="1" readonly="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="esale_osc_product_web_form">
- <field name="name">esale_osc.product.web.form</field>
- <field name="model">esale_osc.product</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Product">
- <separator colspan="4" string="Product Information"/>
- <field name="name" colspan="4" select="1" required="1"/>
- <field name="product_id" on_change="onchange_product_id(product_id, web_id)" select="1" required="1"/>
- <field name="esale_osc_id" readonly="1" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="esale_osc_saleorder_tree">
- <field name="name">esale_osc.saleorder.tree</field>
- <field name="model">sale.order</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Sales Orders">
- <field name="name"/>
- <field name="shipped"/>
- <field name="esale_osc_id"/>
- <field name="esale_osc_web"/>
- <field name="invoiced"/>
- <field name="date_order"/>
- <field name="partner_id"/>
- <field name="partner_shipping_id"/>
- <field name="amount_untaxed"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="esale_osc_saleorder_form">
- <field name="name">esale_osc.saleorder.form</field>
- <field name="model">sale.order</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Sales Order">
- <notebook>
- <page string="Order Line">
- <field name="name" select="1"/>
- <group col="4" colspan="2">
- <field name="shipped" select="1"/>
- <field name="invoiced" select="1"/>
- </group>
- <newline/>
- <field name="esale_osc_id" select="1"/>
- <field name="esale_osc_web" on_change="onchange_esale_osc_web(esale_osc_web)" select="1"/>
- <field name="date_order" select="1"/>
- <field name="shop_id" on_change="onchange_shop_id(shop_id)" select="1"/>
- <field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1" select="1"/>
- <field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
- <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id"/>
- <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id"/>
- <field domain="[('type','=','sale')]" name="pricelist_id"/>
- <field name="project_id" select="1"/>
- <newline/>
- <field colspan="4" name="order_line" nolabel="1" widget="one2many_list"/>
- <newline/>
- <group col="7" colspan="4">
- <field name="amount_untaxed"/>
- <field name="amount_tax"/>
- <field name="amount_total"/>
- <button name="button_dummy" states="draft" string="Compute" type="object"/>
- </group>
- <group col="13" colspan="4">
- <field name="state" select="1"/>
- <button name="order_confirm" states="draft" string="Confirm Order"/>
- <button name="osc_action_cancel" states="manual,progress" string="Cancel Order" type="object"/>
- <button name="cancel" states="draft" string="Cancel Order"/>
- <button name="invoice_cancel" states="invoice_except" string="Cancel Order"/>
- <button name="invoice_recreate" states="invoice_except" string="Recreate Invoice"/>
- <button name="invoice_corrected" states="invoice_except" string="Invoice Corrected"/>
- <button name="ship_cancel" states="shipping_except" string="Cancel Order"/>
- <button name="ship_recreate" states="shipping_except" string="Recreate Procurement"/>
- <button name="ship_corrected" states="shipping_except" string="Procurement Corrected"/>
- <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
- <button name="manual_invoice" states="manual" string="Create Invoice"/>
- </group>
- </page>
- <page string="Other data">
- <field name="incoterm"/>
- <field name="picking_policy" required="True"/>
- <field name="user_id"/>
- <field name="order_policy"/>
- <field name="origin"/>
- <field name="invoice_quantity"/>
- <field name="client_order_ref"/>
- <separator colspan="4" string="Notes"/>
- <field colspan="4" name="note" nolabel="1"/>
- </page>
- <page string="History">
- <separator colspan="4" string="Related invoices"/>
- <field colspan="4" name="invoice_ids" nolabel="1"/>
- <separator colspan="4" string="Related packings"/>
- <field colspan="4" name="picking_ids" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_saleorder_form">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">sale.order</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="esale_osc_saleorder_form"/>
- <field name="domain">[('esale_osc_id','!=', 0)]</field>
- </record>
- <menuitem name="Sales Management/Internet Sales/Sale Orders" id="menu_action_esale_osc_saleorder" action="action_saleorder_form" groups="admin"/>
-
-
-</data>
-</terp>
-
diff --git a/addons/esale_osc/esale_osc_wizard.xml b/addons/esale_osc/esale_osc_wizard.xml
deleted file mode 100644
index b85eb6b0ee0..00000000000
--- a/addons/esale_osc/esale_osc_wizard.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <wizard string="Export products" model="esale_osc.web" name="esale_osc.products"
- id="wizard_esale_osc_products"/>
- <wizard string="Update stocks" model="esale_osc.web" name="esale_osc.stocks"
- id="wizard_esale_osc_stocks"/>
- <wizard string="Import sale orders" model="esale_osc.web" name="esale_osc.saleorders"
- id="wizard_esale_osc_saleorders"/>
- </data>
-</terp>
-
diff --git a/addons/esale_osc/esale_osc_workflow.xml b/addons/esale_osc/esale_osc_workflow.xml
deleted file mode 100644
index 71f7596c2e0..00000000000
--- a/addons/esale_osc/esale_osc_workflow.xml
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <record model="workflow" id="wkf_osc_sale">
- <field name="name">esale_osc.saleorder.basic</field>
- <field name="osv">esale_osc.saleorder</field>
- <field name="on_create">True</field>
- </record>
-
- #----------------------------------------------
- # Activity
- #----------------------------------------------
- <record model="workflow.activity" id="act_draft">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="flow_start">True</field>
- <field name="name">draft</field>
- </record>
- <record model="workflow.activity" id="act_router">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">router</field>
- <field name="kind">function</field>
- <field name="action">action_wait()</field>
- <field name="split_mode">OR</field>
- </record>
- <record model="workflow.activity" id="act_wait_invoice">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">wait_invoice</field>
- </record>
- <record model="workflow.activity" id="act_wait_ship">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">wait_ship</field>
- </record>
-
- <record model="workflow.activity" id="act_done">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">done</field>
- <field name="flow_stop">True</field>
- <field name="kind">function</field>
- <field name="action">write({'state':'done'})</field>
- <field name="join_mode">AND</field>
- </record>
- <record model="workflow.activity" id="act_cancel">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">cancel</field>
- <field name="flow_stop">True</field>
- <field name="kind">stopall</field>
- <field name="action">action_cancel()</field>
- </record>
- <record model="workflow.activity" id="act_cancel2">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">cancel2</field>
- <field name="flow_stop">True</field>
- <field name="kind">stopall</field>
- <field name="action">action_cancel()</field>
- </record>
- <record model="workflow.activity" id="act_cancel3">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">cancel3</field>
- <field name="flow_stop">True</field>
- <field name="kind">stopall</field>
- <field name="action">action_cancel()</field>
- </record>
-
- <record model="workflow.activity" id="act_invoice">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">invoice</field>
- <field name="kind">subflow</field>
- <field name="subflow_id" search="[('name','=','account.invoice.basic')]"/>
- <field name="action">action_invoice_create()</field>
- </record>
- <record model="workflow.activity" id="act_invoice_except">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">invoice_except</field>
- <field name="kind">function</field>
- <field name="action">write({'state':'invoice_except', 'invoice_id':False})</field>
- </record>
- <record model="workflow.activity" id="act_invoice_end">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">invoice_end</field>
- <field name="kind">function</field>
- <field name="action">write({'invoiced':1})</field>
- </record>
- <record model="workflow.activity" id="act_invoice_cancel">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">invoice_cancel</field>
- <field name="flow_stop">True</field>
- <field name="kind">stopall</field>
- <field name="action">action_cancel()</field>
- </record>
-
- <record model="workflow.activity" id="act_ship">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">ship</field>
- <field name="kind">function</field>
- <!--
- <field name="kind">subflow</field>
- <field name="subflow_id" search="[('osv','=','stock.picking')]"/>
- -->
- <field name="action">action_ship_create()</field>
- </record>
- <record model="workflow.activity" id="act_ship_except">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">ship_except</field>
- <field name="kind">function</field>
- <field name="action">write({'state':'shipping_except'})</field>
- </record>
- <record model="workflow.activity" id="act_ship_end">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">ship_end</field>
- <field name="kind">function</field>
- <field name="action">action_ship_end()</field>
- </record>
- <record model="workflow.activity" id="act_ship_cancel">
- <field name="wkf_id" ref="wkf_osc_sale"/>
- <field name="name">ship_cancel</field>
- <field name="flow_stop">True</field>
- <field name="kind">stopall</field>
- <field name="action">action_cancel()</field>
- </record>
-
- #----------------------------------------------
- # Transistion
- #----------------------------------------------
-
- <record model="workflow.transition" id="trans_invoice_end_done">
- <field name="act_from" ref="act_invoice_end"/>
- <field name="act_to" ref="act_done"/>
- </record>
- <record model="workflow.transition" id="trans_draft_router">
- <field name="act_from" ref="act_draft"/>
- <field name="act_to" ref="act_router"/>
- <field name="signal">order_confirm</field>
- </record>
- <record model="workflow.transition" id="trans_draft_cancel">
- <field name="act_from" ref="act_draft"/>
- <field name="act_to" ref="act_cancel"/>
- <field name="signal">cancel</field>
- </record>
- <record model="workflow.transition" id="trans_router_wait_invoice">
- <field name="act_from" ref="act_router"/>
- <field name="act_to" ref="act_wait_invoice"/>
- </record>
- <record model="workflow.transition" id="trans_router_wait_ship">
- <field name="act_from" ref="act_router"/>
- <field name="act_to" ref="act_wait_ship"/>
- </record>
- <record model="workflow.transition" id="trans_wait_invoice_cancel2">
- <field name="act_from" ref="act_wait_invoice"/>
- <field name="act_to" ref="act_cancel2"/>
- <field name="signal">cancel</field>
- </record>
- <record model="workflow.transition" id="trans_wait_ship_cancel3">
- <field name="act_from" ref="act_wait_ship"/>
- <field name="act_to" ref="act_cancel3"/>
- <field name="signal">cancel</field>
- </record>
- <record model="workflow.transition" id="trans_wait_ship_ship">
- <field name="act_from" ref="act_wait_ship"/>
- <field name="act_to" ref="act_ship"/>
- <field name="condition">(order_policy!='prepaid') or invoiced</field>
- </record>
- <record model="workflow.transition" id="trans_wait_invoice_invoice">
- <field name="act_from" ref="act_wait_invoice"/>
- <field name="act_to" ref="act_invoice"/>
- <field name="condition">(order_policy=='prepaid') or ((order_policy=='postpaid') and shipped)</field>
- </record>
- <record model="workflow.transition" id="trans_wait_invoice_invoice_manual">
- <field name="act_from" ref="act_wait_invoice"/>
- <field name="act_to" ref="act_invoice"/>
- <field name="signal">manual_invoice</field>
- </record>
- <record model="workflow.transition" id="trans_invoice_invoice_end">
- <field name="act_from" ref="act_invoice"/>
- <field name="act_to" ref="act_invoice_end"/>
- <field name="signal">subflow.paid</field>
- </record>
- <record model="workflow.transition" id="trans_invoice_invoice_except">
- <field name="act_from" ref="act_invoice"/>
- <field name="act_to" ref="act_invoice_except"/>
- <field name="signal">subflow.cancel</field>
- </record>
- <record model="workflow.transition" id="trans_invoice_except_invoice">
- <field name="act_from" ref="act_invoice_except"/>
- <field name="act_to" ref="act_invoice"/>
- <field name="signal">invoice_recreate</field>
- </record>
- <record model="workflow.transition" id="trans_invoice_except_invoice_end">
- <field name="act_from" ref="act_invoice_except"/>
- <field name="act_to" ref="act_invoice_end"/>
- <field name="signal">invoice_corrected</field>
- </record>
- <record model="workflow.transition" id="trans_invoice_except_invoice_cancel">
- <field name="act_from" ref="act_invoice_except"/>
- <field name="act_to" ref="act_invoice_cancel"/>
- <field name="signal">invoice_cancel</field>
- </record>
- <record model="workflow.transition" id="trans_ship_end_done">
- <field name="act_from" ref="act_ship_end"/>
- <field name="act_to" ref="act_done"/>
- </record>
- <record model="workflow.transition" id="trans_ship_ship_end">
- <field name="act_from" ref="act_ship"/>
- <field name="act_to" ref="act_ship_end"/>
- <field name="trigger_model">mrp.procurement</field>
- <field name="trigger_expr_id">procurement_lines_get()</field>
- <field name="condition">test_procurement_finnished()</field>
- </record>
- <record model="workflow.transition" id="trans_ship_ship_except">
- <field name="act_from" ref="act_ship"/>
- <field name="act_to" ref="act_ship_except"/>
- <field name="condition">test_procurement_finnished('cancel')</field>
- </record>
- <record model="workflow.transition" id="trans_ship_except_ship">
- <field name="act_from" ref="act_ship_except"/>
- <field name="act_to" ref="act_ship"/>
- <field name="signal">ship_recreate</field>
- </record>
- <record model="workflow.transition" id="trans_">
- <field name="act_from" ref="act_ship_except"/>
- <field name="act_to" ref="act_ship_end"/>
- <field name="signal">ship_corrected</field>
- </record>
- <record model="workflow.transition" id="trans_ship_except_ship_cancel">
- <field name="act_from" ref="act_ship_except"/>
- <field name="act_to" ref="act_ship_cancel"/>
- <field name="signal">ship_cancel</field>
- </record>
-
-</data>
-</terp>
diff --git a/addons/esale_osc/wizard/__init__.py b/addons/esale_osc/wizard/__init__.py
deleted file mode 100644
index 5c2068af269..00000000000
--- a/addons/esale_osc/wizard/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import wizard_esale_osc_export_products
-import wizard_esale_osc_import_sos
-import wizard_esale_osc_update_stocks
diff --git a/addons/esale_osc/wizard/wizard_esale_osc_export_products.py b/addons/esale_osc/wizard/wizard_esale_osc_export_products.py
deleted file mode 100644
index 0ab5fa694b1..00000000000
--- a/addons/esale_osc/wizard/wizard_esale_osc_export_products.py
+++ /dev/null
@@ -1,124 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import netsvc
-import pooler
-import wizard
-from osv import osv
-
-_export_done_form = '''<?xml version="1.0"?>
-<form string="Product Export">
- <separator string="Products exported" colspan="4" />
- <field name="prod_new"/>
- <newline/>
- <field name="prod_update"/>
-</form>'''
-
-_export_done_fields = {
- 'prod_new': {'string':'New products', 'type':'float', 'readonly': True},
- 'prod_update': {'string':'Updated products', 'type':'float', 'readonly': True},
-}
-
-def _do_export(self, cr, uid, data, context):
- self.pool = pooler.get_pool(cr.dbname)
- website=self.pool.get('esale_osc.web').browse(cr, uid, [data['id']])[0]
- pricelist = website.shop_id.pricelist_id.id
- print "%s/tinyerp-syncro.php" % website.url
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
-
- prod_new = 0
- prod_update = 0
- for osc_product in website.product_ids:
- attachs = self.pool.get('ir.attachment').search(cr, uid, [('res_model','=','product.product'), ('res_id', '=',osc_product.product_id.id)])
- data = self.pool.get('ir.attachment').read(cr, uid, attachs)
-
- category_ids=self.pool.get('esale_osc.category').search(cr, uid, [('web_id','=', website.id), ('category_id', '=', osc_product.product_id.categid)])
- if len(category_ids)>0:
- category_id=category_ids[1]
- else:
- category_id=0
-
- print [pricelist], osc_product.id, 1, 'list'
- webproduct={
- 'product_id' : osc_product.esale_osc_id,
- 'quantity' : self.pool.get('product.product')._product_virtual_available(cr, uid, [osc_product.product_id.id], '', False, {'shop':website.shop_id.id})[osc_product.product_id.id],
- 'model' : osc_product.product_id.code,
- 'price' : 10, #self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], osc_product.product_id.id, 1, 'list')[pricelist],
- 'weight' : float(osc_product.product_id.weight),
-# 'tax_class_id' : osc_product.esale_osc_tax_id,
- 'tax_class_id' : 1,
- 'category_id' : category_id,
- }
- if len(data):
- webproduct['haspic'] = 1
- webproduct['picture'] = data[0]['datas']
- webproduct['fname'] = data[0]['datas_fname']
- else:
- webproduct['haspic'] =0
-
- langs={}
- products_pool=self.pool.get('product.product')
- for lang in website.language_ids:
- if lang.language_id and lang.language_id.translatable:
- langs[str(lang.esale_osc_id)] = {
- 'name': products_pool.read(cr, uid, [osc_product.product_id.id], ['name'], {'lang': lang.language_id.code})[0]['name'] or '',
- 'description': products_pool.read(cr, uid, [osc_product.product_id.id], ['description_sale'], {'lang': lang.language_id.code})[0]['description_sale'] or ''
- }
-
- webproduct['langs'] = langs
- webproduct['name'] = str(osc_product.product_id.name)
- webproduct['description'] = str(osc_product.product_id.description_sale)
-
- osc_id=server.set_product(webproduct)
-
- if osc_id!=osc_product.esale_osc_id:
- self.pool.get('esale_osc.product').write(cr, uid, [osc_product.id], {'esale_osc_id': osc_id})
- cr.commit()
- prod_new += 1
- else:
- prod_update += 1
-
- return {'prod_new':prod_new, 'prod_update':prod_update}
-
-class wiz_esale_osc_products(wizard.interface):
-
- states = { 'init' : { 'actions' : [_do_export],
- 'result' : { 'type' : 'form',
- 'arch' : _export_done_form,
- 'fields': _export_done_fields,
- 'state' : [('end', 'End')]
- }
- }
- }
-
-
-wiz_esale_osc_products('esale_osc.products');
diff --git a/addons/esale_osc/wizard/wizard_esale_osc_import_sos.py b/addons/esale_osc/wizard/wizard_esale_osc_import_sos.py
deleted file mode 100644
index 41a2f2e6f31..00000000000
--- a/addons/esale_osc/wizard/wizard_esale_osc_import_sos.py
+++ /dev/null
@@ -1,115 +0,0 @@
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import pooler
-import wizard
-from osv import osv
-
-_import_form = '''<?xml version="1.0"?>
-<form title="Categories import" />
-'''
-
-_import_fields = {}
-
-_import_done_form = '''<?xml version="1.0"?>
-<form title="Saleorders import">
-<separator string="saleorders succesfully imported" colspan="4" />
-</form>'''
-
-_import_done_fields = {}
-
-def _do_import(self, cr, uid, data, context):
- self.pool = pooler.get_pool(cr.dbname)
- website = self.pool.get('esale_osc.web').browse(cr, uid, data['id'])
-
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
-
- cr.execute("select max(esale_osc_id) from sale_order where esale_osc_web=%s;" % str(website.id))
- max_web_id=cr.fetchone()[0]
- min_openorder=-1
- if max_web_id:
- saleorders = server.get_saleorders(max_web_id)
- min_openorder = server.get_min_open_orders(max_web_id)
- else:
- saleorders = server.get_saleorders(0)
-
- for saleorder in saleorders:
- print str(saleorder)
- value={ 'esale_osc_web' : website.id,
- 'esale_osc_id' : saleorder['id'],
- 'shop_id' : website.shop_id.id,
- 'partner_id' : website.partner_anonymous_id.id,
- }
- saleorder_pool=self.pool.get('sale.order')
- value.update(saleorder_pool.onchange_shop_id(cr, uid, [], value['shop_id'])['value'])
- value.update(saleorder_pool.onchange_partner_id(cr, uid, [], value['partner_id'])['value'])
- addresses_pool = self.pool.get('res.partner.address')
- for address in [('address','order'), ('billing', 'invoice'), ('delivery', 'shipping')]:
- criteria = [('partner_id', '=', website.partner_anonymous_id.id)]
- insert = {'partner_id': website.partner_anonymous_id.id}
- for criterium in [('city', 'city'), ('name', 'name'), ('zip','zip'), ('address', 'street') ]:
- criteria.append((criterium[1], 'like', saleorder[address[0]][criterium[0]]))
- insert[criterium[1]]=saleorder[address[0]][criterium[0]]
- address_ids=addresses_pool.search(cr, uid, criteria)
- if len(address_ids):
- id=address_ids[0]
- else:
- country_ids=self.pool.get('res.country').search(cr, uid, [('name', 'ilike', saleorder[address[0]]['country'])])
- if len(country_ids):
- country_id=country_ids[0]
- else:
- country_id=self.pool.get('res.country').create(cr, uid, { 'name' : saleorder[address[0]]['country'],
- 'code' : saleorder[address[0]]['country'][0:2].lower()})
- insert['country_id']=country_id
- if address[0]=='address':
- insert['email']=saleorder['address']['email']
- id=addresses_pool.create(cr, uid, insert)
-
- value.update({'partner_%s_id' % address[1]: id})
-
- order_id=saleorder_pool.create(cr, uid, value)
- for orderline in saleorder['lines']:
- ids=self.pool.get('esale_osc.product').search(cr, uid, [('esale_osc_id', '=', orderline['product_id']), ('web_id', '=', website.id)])
- if len(ids):
- osc_product_id=ids[0]
- osc_product=self.pool.get('esale_osc.product').browse(cr, uid, osc_product_id)
- linevalue={ 'product_id' : osc_product.product_id.id,
- 'product_uom_qty' : orderline['product_qty'],
- 'order_id' : order_id
- }
- linevalue.update(self.pool.get('sale.order.line').product_id_change(cr, uid, [], value['pricelist_id'], linevalue['product_id'], linevalue['product_uom_qty'])['value'])
- linevalue.update(self.pool.get('sale.order.line').default_get(cr, uid, ['sequence', 'invoiced', 'state', 'product_packaging']))
- del linevalue['weight']
- linevalue["product_uos"]= linevalue['product_uos'][0]
- tax_id=linevalue['tax_id'][0]
- del linevalue['tax_id']
- ids=self.pool.get('sale.order.line').create(cr, uid, linevalue)
- cr.execute('insert into sale_order_tax (order_line_id,tax_id) values (%d,%d)', (ids, tax_id))
- cr.commit()
- for saleorder in saleorders:
- server.process_order(saleorder['id'])
-
- ###################### look for open orders in site that are 'done' in TinyERP ###################
- ###################### and close them ###################
- if (min_openorder > -1):
- cr.execute("select esale_osc_id from sale_order where (esale_osc_id>=%d) and (state = 'done') and (esale_osc_web=%d);", (min_openorder,website.id))
- openorders=cr.fetchall()
- for openorder in openorders:
- server.close_open_orders(openorder[0])
- return {}
-
-class wiz_esale_osc_import_sos(wizard.interface):
-
- states = { 'init' : { 'actions' : [_do_import],
- 'result' : { 'type' : 'form',
- 'arch' : _import_done_form,
- 'fields': _import_done_fields,
- 'state' : [('end', 'End')]
- }
- }
- }
-
-
-wiz_esale_osc_import_sos('esale_osc.saleorders');
diff --git a/addons/esale_osc/wizard/wizard_esale_osc_update_stocks.py b/addons/esale_osc/wizard/wizard_esale_osc_update_stocks.py
deleted file mode 100644
index f84f14d2b10..00000000000
--- a/addons/esale_osc/wizard/wizard_esale_osc_update_stocks.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import ir
-import time
-import os
-import netsvc
-import xmlrpclib
-import pooler
-import wizard
-from osv import osv
-
-
-_export_done_form = '''<?xml version="1.0"?>
-<form string="Stock Update">
-<separator string="Stock succesfully updated" colspan="4" />
-</form>'''
-
-_export_done_fields = {}
-
-def _do_export(self, cr, uid, data, context):
- self.pool = pooler.get_pool(cr.dbname)
- website=self.pool.get('esale_osc.web').browse(cr, uid, [data['id']])[0]
- server = xmlrpclib.ServerProxy("%s/tinyerp-syncro.php" % website.url)
- for osc_product in website.product_ids:
- webproduct={
- 'product_id' : osc_product.esale_osc_id,
- 'quantity' : self.pool.get('product.product')._product_virtual_available(cr, uid, [osc_product.product_id.id], '', False, {'shop':website.shop_id.id})[osc_product.product_id.id]
- }
- osc_id=server.set_product_stock(webproduct)
- return {}
-
-class wiz_esale_osc_stocks(wizard.interface):
-
- states = { #'init' : { 'actions' : [],
- # 'result' : { 'type' : 'form',
- # 'arch' : _import_form,
- # 'fields' : _import_fields,
- # 'state' : [('import', 'Import languages and taxes'), ('end', 'Cancel')]
- # },
- # },
- 'init' : { 'actions' : [_do_export],
- 'result' : { 'type' : 'form',
- 'arch' : _export_done_form,
- 'fields' : _export_done_fields,
- 'state' : [('end', 'End')]
- }
- }
- }
-
-
-wiz_esale_osc_stocks('esale_osc.stocks');
-
diff --git a/addons/hr_contract_available/__init__.py b/addons/hr_contract_available/__init__.py
deleted file mode 100644
index a77d4a680b8..00000000000
--- a/addons/hr_contract_available/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import hr_contract_available
diff --git a/addons/hr_contract_available/__terp__.py b/addons/hr_contract_available/__terp__.py
deleted file mode 100644
index d0ab15655d1..00000000000
--- a/addons/hr_contract_available/__terp__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "Human Resources Contracts",
- "version" : "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Human Resources",
- "website" : "http://tinyerp.com/module_hr.html",
- "depends" : ["hr_contract"],
- "module": "",
- "description": """
- This module is a reservation system on employees.
-
- You can assign an employee to a poste or a department for a
- defined period. This module is used to track availability and
- reservations on human ressources.
- """,
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["hr_contract_available_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/hr_contract_available/hr_contract_available.py b/addons/hr_contract_available/hr_contract_available.py
deleted file mode 100644
index 42e9ffd8304..00000000000
--- a/addons/hr_contract_available/hr_contract_available.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-import time
-
-class hr_employee(osv.osv):
- _inherit = "hr.employee"
- def _get_state(self, cr, uid, ids, name, args, context):
- result = {}
- t = time.strftime('%Y-%m-%d')
- for emp in self.browse(cr, uid, ids, context):
- result[emp.id] = 'no'
-
- for alloc in emp.allocation_ids:
- if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t):
- result[emp.id] = alloc.state
- return result
- def _get_date_end(self, cr, uid, ids, name, args, context):
- result = {}
- for emp in self.browse(cr, uid, ids, context):
- result[emp.id] = False
- if len( emp.allocation_ids):
- result[emp.id] = emp.allocation_ids[-1].date_end or False
- return result
- def _get_department_id(self, cr, uid, ids, name, args, context):
- result = {}
- t = time.strftime('%Y-%m-%d')
- for emp in self.browse(cr, uid, ids, context):
- result[emp.id] = False
- for alloc in emp.allocation_ids:
- if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t):
- result[emp.id] = alloc.department_id.id
- return result
- _columns = {
- 'allocation_ids' : fields.one2many('hr.allocation', 'employee_id', 'Allocations'),
- 'allocation_state': fields.function(_get_state,
- method=True,
- type='selection',
- selection=[('no','/'),('unavailable','Unavailable'),('ondemand','On demand'),('available','Available')],
- string='Current Availability'),
- 'allocation_department_id': fields.function(_get_department_id, method=True, type='many2one', relation='res.company', string='Current Department'),
- 'allocation_date_end': fields.function(_get_date_end, method=True, type='date', string='Availability Date')
- }
-hr_employee()
-
-class hr_allocation(osv.osv):
- _name = 'hr.allocation'
- _description = 'Allocations'
- _columns = {
- 'name' : fields.char('Allocation Name', size=30, required=True),
- 'employee_id' : fields.many2one('hr.employee', 'Employee', required=True),
- 'department_id' : fields.many2one('res.company', 'Department', required=True),
- 'function' : fields.many2one('res.partner.function', 'Function'),
- 'date_start' : fields.date('Start Date', required=True),
- 'date_end' : fields.date('End Date', help="Keep empty for unlimited allocation."),
- 'state' : fields.selection([('unavailable','Unavailable'),('ondemand','On demand'),('available','Available')], 'State', required=True),
- }
- _order = 'date_start'
- _defaults = {
- 'date_start' : lambda *a : time.strftime("%Y-%m-%d"),
- 'state' : lambda *a : 'ondemand',
- 'department_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
- }
-hr_allocation()
-
diff --git a/addons/hr_contract_available/hr_contract_available_view.xml b/addons/hr_contract_available/hr_contract_available_view.xml
deleted file mode 100644
index 560ec2e00bd..00000000000
--- a/addons/hr_contract_available/hr_contract_available_view.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<terp>
- <data>
-
- <record model="ir.ui.view" id="hr_hr_employee_view_form2">
- <field name="name">hr.hr.employee.view.form2</field>
- <field name="model">hr.employee</field>
- <field name="inherit_id" ref="hr.view_employee_form"/>
- <field name="arch" type="xml">
- <notebook position="inside">
- <page string="Availabilities">
- <field name="allocation_state"/>
- <field name="allocation_date_end"/>
- <field name="allocation_department_id"/>
- <newline/>
- <field name="allocation_ids" colspan="4" nolabel="1">
- <tree string="Allocations">
- <field name="department_id"/>
- <field name="function"/>
- <field name="date_start"/>
- <field name="date_end"/>
- <field name="state"/>
- </tree>
-
- <form string="Allocations">
- <field name="name" colspan="4"/>
- <field name="department_id"/>
- <field name="function"/>
- <field name="date_start"/>
- <field name="date_end"/>
- <field name="state"/>
- </form>
- </field>
- </page>
- </notebook>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_employee_list_available">
- <field name="name">hr.employee.available.tree</field>
- <field name="model">hr.employee</field>
- <field name="type">tree</field>
- <field name="inherit_id" ref="hr.view_employee_list"/>
- <field name="arch" type="xml">
- <field name="parent_id" position="replace">
- <field name="allocation_state"/>
- <field name="allocation_date_end"/>
- <field name="allocation_department_id"/>
- </field>
- </field>
- </record>
-
- <act_window name="Allocations"
- domain="[('employee_id', '=', active_id)]"
- res_model="hr.allocation"
- src_model="hr.employee"
- id="act_hr_employee_2_hr_allocation"/>
-
- <act_window name="Allocations"
- domain="[('department_id', '=', active_id)]"
- res_model="hr.allocation"
- src_model="hr.company"
- id="act_hr_company_2_hr_allocation"/>
-
- </data>
-</terp>
-
-
diff --git a/addons/hr_evaluation/__init__.py b/addons/hr_evaluation/__init__.py
deleted file mode 100644
index fe1d988f58d..00000000000
--- a/addons/hr_evaluation/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: hr.py 3428 2006-06-22 23:17:17Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-
-import hr_evaluation
-
-
diff --git a/addons/hr_evaluation/__terp__.py b/addons/hr_evaluation/__terp__.py
deleted file mode 100644
index 60d79f9c19f..00000000000
--- a/addons/hr_evaluation/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "Human Resources Evaluation",
- "version" : "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Human Resources",
- "website" : "http://tinyerp.com/module_hr.html",
- "depends" : ["hr"],
- "description": "Ability to create employees evaluation.",
- "init_xml" : [],
- "demo_xml" : ["hr_evaluation_demo.xml"],
- "update_xml" : ["hr_evaluation_view.xml"],
- "active": False,
- "installable": False
-}
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
deleted file mode 100644
index 1ecf959dae8..00000000000
--- a/addons/hr_evaluation/hr_evaluation.py
+++ /dev/null
@@ -1,92 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: hr.py 3428 2006-06-22 23:17:17Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-from osv import fields, osv
-
-class hr_evaluation(osv.osv):
- _name = "hr_evaluation.evaluation"
- _description = "Employee Evaluation"
- _columns = {
- 'name': fields.char("Summary", size=64, required=True),
- 'date': fields.date("Date", required=True),
- 'employee_id': fields.many2one("hr.employee", "Employee", required=True),
- 'user_id': fields.many2one("res.users", "Evaluation User", required=True),
- 'info_good': fields.text('Good Points'),
- 'info_bad': fields.text('Bad Points'),
- 'info_improve': fields.text('To Improve'),
- 'score': fields.float("Score"),
- 'info_employee': fields.text('Employee Response'),
- 'quote_ids': fields.one2many('hr_evaluation.quote', 'evaluation_id', 'Quotes'),
- 'state': fields.selection([('draft','Draft'),('done','Done')], 'State')
- }
- _defaults = {
- 'date' : lambda *a: time.strftime('%Y-%m-%d'),
- 'state' : lambda *a: 'draft',
- 'user_id' : lambda self,cr,uid,context={}: uid
- }
-hr_evaluation()
-
-class hr_evaluation_type(osv.osv):
- _name = "hr_evaluation.type"
- _description = "Employee Evaluation Type"
- _columns = {
- 'name': fields.char("Evaluation Criterion", size=64, required=True),
- 'category_ids': fields.many2many('hr.employee.category', 'hr_evaluation_category_rel', 'type_id', 'category_id', 'Appliable Role'),
- 'active': fields.boolean("Active"),
- 'value_ids': fields.one2many('hr_evaluation.type.value', 'type_id', 'Values'),
- 'info': fields.text('Information'),
- 'score': fields.float('Score'),
- }
- _defaults = {
- 'active' : lambda *a: True,
- }
-hr_evaluation_type()
-
-class hr_evaluation_type_value(osv.osv):
- _name = "hr_evaluation.type.value"
- _description = "Evaluation Type Value"
- _columns = {
- 'name': fields.char("Value", size=64, required=True),
- 'score': fields.float("Score"),
- 'type_id': fields.many2one('hr_evaluation.type', 'Evaluation Type', required=True),
- }
-hr_evaluation_type_value()
-
-class hr_evaluation_quote(osv.osv):
- _name = "hr_evaluation.quote"
- _description = "Employee Evaluation Quote"
- _columns = {
- 'name': fields.char("Quote", size=64),
- 'type_id': fields.many2one('hr_evaluation.type', 'Type'),
- 'score': fields.float("Score"),
- 'value_id': fields.many2one('hr_evaluation.type.value', 'Value', domain="[('type_id','=',type_id)])"),
- 'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation', required=True)
- }
-hr_evaluation_quote()
diff --git a/addons/hr_evaluation/hr_evaluation_demo.xml b/addons/hr_evaluation/hr_evaluation_demo.xml
deleted file mode 100644
index 4a6c439e54d..00000000000
--- a/addons/hr_evaluation/hr_evaluation_demo.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data noupdate="1">
-
- </data>
-</terp>
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
deleted file mode 100644
index 2ee58fb4e5d..00000000000
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <record model="ir.ui.view" id="view_employee_quote_form">
- <field name="name">hr_evaluation.quote.form</field>
- <field name="model">hr_evaluation.quote</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Evalution Quote">
- <field name="name" select="1" colspan="4"/>
- <field name="type_id" select="1"/>
- <field name="value_id" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_employee_quote_tree">
- <field name="name">hr_evaluation.quote.tree</field>
- <field name="model">hr_evaluation.quote</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Evalution Quote">
- <field name="name"/>
- <field name="type_id"/>
- <field name="value_id"/>
- </tree>
- </field>
- </record>
-
-
- <record model="ir.ui.view" id="view_employee_evaluation_form">
- <field name="name">hr_evaluation.evaluation.form</field>
- <field name="model">hr_evaluation.evaluation</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Employee Evaluation">
- <notebook>
- <page string="Informal Data">
- <field name="name" select="1"/>
- <field name="employee_id" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <separator string="Good Points" colspan="2"/>
- <separator string="Bad Points" colspan="2"/>
- <field name="info_good" colspan="2" nolabel="1"/>
- <field name="info_bad" colspan="2" nolabel="1"/>
- <separator string="To Improve" colspan="2"/>
- <separator string="Employee Response" colspan="2"/>
- <field name="info_improve" colspan="2" nolabel="1"/>
- <field name="info_employee" colspan="2" nolabel="1"/>
- <separator string="Status" colspan="4"/>
- <field name="state" search="1"/>
- <button string="Done" states="draft"/>
- <button string="Schedule next evaluation" states="draft,done"/>
- </page><page string="Quotations">
- <field name="quote_ids" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_employee_evaluation_tree">
- <field name="name">hr_evaluation.evaluation.tree</field>
- <field name="model">hr_evaluation.evaluation</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Employee Evaluation">
- <field name="date"/>
- <field name="employee_id"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="open_view_employee_evaluation_form">
- <field name="res_model">hr_evaluation.evaluation</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
- <menuitem
- name="Human Resources/Evaluations/hr Responsible/Evaluations"
- id="menu_open_view_employee_evaluation_form"
- action="open_view_employee_evaluation_form"/>
-
- <record model="ir.actions.act_window" id="open_view_employee_evaluation_next_list">
- <field name="name">Next Employee Evaluation</field>
- <field name="res_model">hr_evaluation.evaluation</field>
- <field name="domain">[('date','&lt;=',time.strftime('%Y-%m-%d'))]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Human Resources/Evaluations/hr Responsible/Next Evaluations"
- id="menu_open_view_employee_evaluation_next_list"
- action="open_view_employee_evaluation_next_list"/>
-
- <record model="ir.actions.act_window" id="open_view_employee_evaluation_next_my_list">
- <field name="name">My Next Evaluation</field>
- <field name="res_model">hr_evaluation.evaluation</field>
- <field name="domain">[('date','&lt;=',time.strftime('%Y-%m-%d')),('user_id','=',uid)]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Human Resources/Evaluations/hr Responsible/My Next Evaluations"
- id="menu_open_view_employee_evaluation_next_my_list"
- action="open_view_employee_evaluation_next_my_list"
- groups="admin"/>
-
- <!--
- Menu for the employee to view his own preceeding evaluations.
- Todo Filter to this employee only. Use Wizard ?
- -->
- <record model="ir.ui.view" id="view_employee_evaluation_form_ro">
- <field name="name">hr_evaluation.evaluation.form.ro</field>
- <field name="model">hr_evaluation.evaluation</field>
- <field name="type">form</field>
- <field name="priority" eval="32"/>
- <field name="arch" type="xml">
- <form string="Employee Evaluation">
- <notebook>
- <page string="Informal Data">
- <field name="name" select="1" readonly="1"/>
- <field name="employee_id" readonly="1"/>
- <field name="user_id" select="1" readonly="1"/>
- <field name="date" select="1" readonly="1"/>
- <separator string="Good Points" colspan="2"/>
- <separator string="Bad Points" colspan="2"/>
- <field name="info_good" colspan="2" nolabel="1" readonly="1"/>
- <field name="info_bad" colspan="2" nolabel="1" readonly="1"/>
- <separator string="To Improve" colspan="2"/>
- <separator string="Employee Response" colspan="2"/>
- <field name="info_improve" colspan="2" nolabel="1" readonly="1"/>
- <field name="info_employee" colspan="4" nolabel="1" readonly="1"/>
- <separator string="Status" colspan="4"/>
- <field name="state" search="1"/>
- <button string="Done" states="draft"/>
- <button string="Schedule next evaluation" states="draft,done"/>
- </page><page string="Quotations">
- <field name="quote_ids" colspan="4" nolabel="1" readonly="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="open_view_employee_evaluation_my_old_list">
- <field name="res_model">hr_evaluation.evaluation</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- <field name="view_id" ref="view_employee_evaluation_form_ro"/>
- </record>
- <menuitem
- name="Human Resources/Evaluations/My Preceeding Evaluations"
- id="menu_open_view_employee_my_old_evaluation_list"
- action="open_view_employee_evaluation_my_old_list"/>
-
- #
- # Evaluation Criterions
- #
- <record model="ir.ui.view" id="view_evaluation_type_tree">
- <field name="name">hr_evaluation.type.tree</field>
- <field name="model">hr_evaluation.type</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Evaluation Criterion">
- <field name="name" select="1"/>
- <field name="score" select="1"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_evaluation_type_form">
- <field name="name">hr_evaluation.type.form</field>
- <field name="model">hr_evaluation.type</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Evaluation Criterion">
- <notebook>
- <page string="Information">
- <field name="name" select="1"/>
- <field name="active" select="1"/>
- <field name="score" select="1"/>
- <separator string="Choices Results" colspan="4"/>
- <field name="value_ids" colspan="4" nolabel="1"/>
- <separator string="Apply to categories" colspan="4"/>
- <field name="category_ids" colspan="4" nolabel="1">
- <form>
- <field name="name" select="1"/>
- </form>
- </field>
- </page><page string="Notes">
- <field name="info" nolabel="1" colspan="4"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="open_view_evaluation_type_form">
- <field name="res_model">hr_evaluation.type</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
- <menuitem
- name="Human Resources/Evaluations/Configuration/Evaluation Criterions"
- id="menu_open_view_evaluation_type_form"
- action="open_view_evaluation_type_form"/>
-
- </data>
-</terp>
diff --git a/addons/hr_skill/__init__.py b/addons/hr_skill/__init__.py
deleted file mode 100644
index a634ddb4d2a..00000000000
--- a/addons/hr_skill/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import hr_skill
diff --git a/addons/hr_skill/__terp__.py b/addons/hr_skill/__terp__.py
deleted file mode 100644
index 136f38f84ec..00000000000
--- a/addons/hr_skill/__terp__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "Skill Management",
- "version" : "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Human Resources",
- "website": "http://www.tinyerp.com",
- "depends" : ["hr"],
- "description": "Generic and powerfull skill management system. This module allows you to manage your company and employees skills, interviews, ...",
- "demo_xml" : ["hr_skill.weight.category.csv","hr_skill.weight.csv","hr_skill.skill.csv",\
- "hr_skill.profile.csv","hr_skill.position.csv","hr_skill.experience.csv",\
- "hr_skill.experience.category.csv","hr_skill.evaluation.category.csv"],
-# "demo_xml" : ["hr_skill.evaluation.csv"],
- "init_xml" : [],
- "update_xml" : ['hr_skill_report.xml','hr_skill_view.xml'],
- "active": False,
- "installable": False
-}
diff --git a/addons/hr_skill/hr_skill.evaluation.category.csv b/addons/hr_skill/hr_skill.evaluation.category.csv
deleted file mode 100644
index 68587c00811..00000000000
--- a/addons/hr_skill/hr_skill.evaluation.category.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-name
-Interview \ No newline at end of file
diff --git a/addons/hr_skill/hr_skill.evaluation.csv b/addons/hr_skill/hr_skill.evaluation.csv
deleted file mode 100644
index a67370c8b54..00000000000
--- a/addons/hr_skill/hr_skill.evaluation.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-category_id/name,date,interviewee_name,name,interviewer_name,experience_ids/name,experience_ids/experience_id/name,experience_ids/weight_id/name,skill_ids/name,skill_ids/skill_id/name,skill_ids/weight_id/name
-Interview,2006-10-13,John,Interview,Bob,It Degree,It Degree,Fifty-fifty,Français,Français,Good \ No newline at end of file
diff --git a/addons/hr_skill/hr_skill.experience.category.csv b/addons/hr_skill/hr_skill.experience.category.csv
deleted file mode 100644
index 4a5bd426f8d..00000000000
--- a/addons/hr_skill/hr_skill.experience.category.csv
+++ /dev/null
@@ -1,5 +0,0 @@
-name
-College Degree
-Academic Degree
-Advanced Degree
-Professional Experience
diff --git a/addons/hr_skill/hr_skill.experience.csv b/addons/hr_skill/hr_skill.experience.csv
deleted file mode 100644
index c03d4ce44ff..00000000000
--- a/addons/hr_skill/hr_skill.experience.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-category_id/name,name,skill_ids/name,skill_ids/weight_id/name
-Academic Degree,It Degree,Python,Fifty-fifty
-,,Network,Good
-Professional Experience,Language journey,DE,Bad
diff --git a/addons/hr_skill/hr_skill.position.csv b/addons/hr_skill/hr_skill.position.csv
deleted file mode 100644
index e9662565972..00000000000
--- a/addons/hr_skill/hr_skill.position.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-name,profile_ids/name,profile_ids/profile_id,profile_ids/weight_id
-prof,Linguist,Linguist,Good
-Junior IT Consultant,Junior IT,Junior IT,Good \ No newline at end of file
diff --git a/addons/hr_skill/hr_skill.profile.csv b/addons/hr_skill/hr_skill.profile.csv
deleted file mode 100644
index 39c7132b993..00000000000
--- a/addons/hr_skill/hr_skill.profile.csv
+++ /dev/null
@@ -1,5 +0,0 @@
-name,skill_ids/name,skill_ids/weight_id,skill_ids/skill_id
-Linguist,NL,Fifty-fifty,Lang
-,Français,Good,Lang
-Junior IT,Network,Fifty-fifty,Lang
-,Python,Good,Lang
diff --git a/addons/hr_skill/hr_skill.py b/addons/hr_skill/hr_skill.py
deleted file mode 100644
index 0dcfabffd92..00000000000
--- a/addons/hr_skill/hr_skill.py
+++ /dev/null
@@ -1,268 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-
-# ON peut choisir lors de la definititon
-# d'un skill de lui associer des skills
-# de substitution et d'y associer des poids
-# (et donc plus d'arbre ..)
-
-from osv import osv, fields
-
-# Wheight Category
-# eg: years, in english, ..
-class hr_skill_weight_category(osv.osv):
- _name ='hr_skill.weight.category'
- _columns = {
- 'name': fields.char('Name', size=64, required=True),
- }
-
-hr_skill_weight_category()
-
-
-# weight
-# eg: 0 to 1, more than 5, good, bad
-class hr_skill_weight(osv.osv):
- _name ='hr_skill.weight'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- 'value': fields.float('Numerical value', required=True),
- 'category_id': fields.many2one('hr_skill.weight.category', 'Category', required=True, ondelete='cascade'),
- }# hr_skill.category ne passe pas (cad creation des tables) la premiere fois (hr_skill_category bien)
-
-hr_skill_weight()
-
-
-# Skill
-# eg : Spanish, OO programming (-> skill)
-# Langage, IT (->view)
-# Categories of weight
-class hr_skill_skill(osv.osv):
- _name = 'hr_skill.skill'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- 'active': fields.boolean('Active'),
- 'weight': fields.float('Weight', required=True),
- 'weight_category_id': fields.many2one('hr_skill.weight.category','Weight Category'),
- 'parent_id': fields.many2one('hr_skill.skill', 'Parent', ondelete='cascade'),
- 'child_ids': fields.one2many('hr_skill.skill', 'parent_id', 'Childs'),
- 'view': fields.selection([('view','View'), ('skill','Skill')], 'Skill', required=True),
- }
- _defaults = {
- 'view': lambda self,cr,uid,context: 'view',
- 'weight': lambda self,cr,uid,context: 0,
- 'active': lambda self,cr,uid,context: 1
- }
-hr_skill_skill()
-
-
-
-# Experience category
-# eg : a degree or a professional experience
-class hr_skill_experience_category(osv.osv):
- _name ='hr_skill.experience.category'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- }
-hr_skill_experience_category()
-
-
-# Experience
-# eg : a specific former job position or studies
-# each experience is associated with several couple skill - weight
-class hr_skill_experience(osv.osv):
- _name ='hr_skill.experience'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- 'skill_ids': fields.one2many('hr_skill.experience.skill','experience_id','Skills'),
- 'sequence': fields.integer('Sequence'),
- 'category_id' : fields.many2one('hr_skill.experience.category', 'Category'),
- }
-hr_skill_experience()
-
-
-# Evaluation Category
-class hr_skill_evaluation_category(osv.osv):
- _name ='hr_skill.evaluation.category'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- }
-hr_skill_evaluation_category()
-
-# Evaluation
-class hr_skill_evaluation(osv.osv):
- _name ='hr_skill.evaluation'
- _columns = {
- 'name': fields.char('Evaluation name', size=64,required=True),
- 'date': fields.date('Date',required=True),
- 'interviewer_name': fields.char('Evaluator', size=64,required=True),
- 'interviewee_name': fields.char('Evaluated People', size=64,required=True),
- 'employee_id': fields.many2one('hr.employee', 'Evaluated Employee'),
- 'note': fields.text('Notes'),
- 'reference': fields.char('Reference', size=64),
- 'category_id': fields.many2one('hr_skill.evaluation.category', 'Category', change_default=True),
- 'experience_ids': fields.one2many('hr_skill.evaluation.experience','evaluation_id','Experience'),
- 'skill_ids': fields.one2many('hr_skill.evaluation.skill','evaluation_id','Skill'),
-
- }
- def onchange_employee_id(self, cr, uid, ids, employee_id):
- if not employee_id:
- return {}
- empl = self.pool.get('hr.employee').browse(cr, uid, employee_id)
- return {'value': {'interviewee_name':empl.name} }
-
-hr_skill_evaluation()
-
-# Profile
-# eg : management, web-dev.
-# each profile is associated with several couple skill - weight
-class hr_skill_profile(osv.osv):
- _name ='hr_skill.profile'
- _columns = {
- 'name': fields.char('Name', size=64, required=True),
- 'skill_ids': fields.one2many('hr_skill.profile.skill','profile_id','Skills'),
- }
-hr_skill_profile()
-
-
-# Position
-# eg : Senior web-dev, junior logistician
-# a position is associated to one (or several) profile
-class hr_skill_position(osv.osv):
- _name ='hr_skill.position'
- _columns = {
- 'name': fields.char('Name', size=64, required=True),
- 'employee_id': fields.many2one('hr.employee', 'Assigned Employee'),# ?? pq un many2one ?
- 'profile_ids': fields.one2many('hr_skill.position.profile', 'position_id', 'Profiles'),
- 'status': fields.selection([('open','Open'), ('assigned','Assigned'), ('unused','Unused')], 'Status'),
- }
-hr_skill_position()
-
-
-
-# definitition des relations :
-class hr_skill_position_profile(osv.osv):
- _name ='hr_skill.position.profile'
- _columns = {
- 'name': fields.char('Name', size=64),
- 'weight_id': fields.many2one('hr_skill.weight','Weight',required=True),
- 'position_id': fields.many2one('hr_skill.position','Position', ondelete='cascade',required=True),
- 'profile_id': fields.many2one('hr_skill.profile','Profile', ondelete='cascade',required=True) ,
- }
- def onchange_profile_id(self, cr, uid, ids, profile_id):
- if not profile_id:
- return {}
- prof = self.pool.get('hr_skill.profile').browse(cr, uid, profile_id)
- return {'value': {'name':prof.name} }
-hr_skill_position_profile()
-
-
-class hr_skill_experience_skill(osv.osv):
- _name ='hr_skill.experience.skill'
- _columns = {
- 'name': fields.char('Name', size=64, required=True),
- 'weight_id': fields.many2one('hr_skill.weight','Weight', required=True),
- 'skill_id': fields.many2one('hr_skill.skill','Skill', ondelete='cascade',required=True),
- 'experience_id': fields.many2one('hr_skill.experience','Experience', ondelete='cascade',required=True) ,
- }
- def onchange_skill_id(self, cr, uid, ids, skill_id):
- if not skill_id:
- return {}
- sk = self.pool.get('hr_skill.skill').browse(cr, uid, skill_id)
- return {'value': {'name':sk.name} }
-
-hr_skill_experience_skill()
-
-
-
-class hr_skill_profile_skill(osv.osv):
- _name ='hr_skill.profile.skill'
- _columns = {
- 'name': fields.char('Name', size=64),
- 'weight_id': fields.many2one('hr_skill.weight','Weight',required=True),
- 'profile_id': fields.many2one('hr_skill.profile','Profile', ondelete='cascade',required=True),
- 'skill_id': fields.many2one('hr_skill.skill','Skill', ondelete='cascade',required=True, domain=[('view','<>','view')]),
- }
-
- def onchange_skill_id(self, cr, uid, ids, skill_id):
- if not skill_id:
- return {}
- sk = self.pool.get('hr_skill.skill').browse(cr, uid, skill_id)
- return {'value': {'name':sk.name} }
-
-hr_skill_profile_skill()
-
-
-
-class hr_skill_position_profile(osv.osv):
- _name ='hr_skill.position.profile'
- _columns = {
- 'name': fields.char('Name', size=64),
- 'weight_id': fields.many2one('hr_skill.weight','Weight',required=True, ondelete='cascade'),
- 'position_id': fields.many2one('hr_skill.position','Position', ondelete='cascade',required=True),
- 'profile_id': fields.many2one('hr_skill.profile','Profile', ondelete='cascade',required=True),
- }
-hr_skill_profile_skill()
-
-
-
-class hr_skill_evaluation_experience(osv.osv):
- _name ='hr_skill.evaluation.experience'
- _columns = {
- 'name': fields.char('Name', size=64,required=True),
- 'weight_id': fields.many2one('hr_skill.weight','Weight',required=True),
- 'evaluation_id': fields.many2one('hr_skill.evaluation','Evaluation', ondelete='cascade', required=True),
- 'experience_id': fields.many2one('hr_skill.experience','Experience', ondelete='cascade', required=True),
- }
-
- def onchange_experience_id(self, cr, uid, ids, experience_id):
- if not experience_id:
- return {}
- exp = self.pool.get('hr_skill.experience').browse(cr, uid, experience_id)
- return {'value': {'name':exp.name} }
-
-hr_skill_evaluation_experience()
-
-
-
-class hr_skill_evaluation_skill(osv.osv):
- _name ='hr_skill.evaluation.skill'
- _columns = {
- 'name': fields.char('Name', size=64),
- 'weight_id': fields.many2one('hr_skill.weight','Weight',required=True),
- 'evaluation_id': fields.many2one('hr_skill.evaluation','Evaluation', ondelete='cascade', required=True),
- 'skill_id': fields.many2one('hr_skill.skill','Skill', ondelete='cascade', required=True),
- }
- def onchange_skill_id(self, cr, uid, ids, skill_id):
- if not skill_id:
- return {}
- sk = self.pool.get('hr_skill.skill').browse(cr, uid, skill_id)
- return {'value': {'name':sk.name} }
-
-hr_skill_evaluation_skill()
-
diff --git a/addons/hr_skill/hr_skill.skill.csv b/addons/hr_skill/hr_skill.skill.csv
deleted file mode 100644
index 947631805b0..00000000000
--- a/addons/hr_skill/hr_skill.skill.csv
+++ /dev/null
@@ -1,12 +0,0 @@
-name,view,parent_id,active
-IT,View,,1
-Lang,View,,1
-Development,View,IT,1
-Germanique,View,Lang,1
-Latin,View,Lang,1
-Français,Skill,Latin,1
-NL,Skill,Germanique,1
-DE,Skill,Germanique,1
-Network,Skill,IT,1
-Python,Skill,Development,1
-Erlang,Skill,Development,1
diff --git a/addons/hr_skill/hr_skill.weight.category.csv b/addons/hr_skill/hr_skill.weight.category.csv
deleted file mode 100644
index 300a8f5b1d4..00000000000
--- a/addons/hr_skill/hr_skill.weight.category.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-name
-General
-Years \ No newline at end of file
diff --git a/addons/hr_skill/hr_skill.weight.csv b/addons/hr_skill/hr_skill.weight.csv
deleted file mode 100644
index 47e17bf28cb..00000000000
--- a/addons/hr_skill/hr_skill.weight.csv
+++ /dev/null
@@ -1,8 +0,0 @@
-category_id,name,value
-General,Bad,0.01
-General,Fifty-fifty,0.5
-General,Good,1.0
-Years,None,
-Years,less than one,0.2
-Years,From 1 to 5,0.5
-Years,More than 5,0.7 \ No newline at end of file
diff --git a/addons/hr_skill/hr_skill_demo.xml b/addons/hr_skill/hr_skill_demo.xml
deleted file mode 100644
index ce59f351e27..00000000000
--- a/addons/hr_skill/hr_skill_demo.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
- <record id="hr_skill_wheight_category" model="hr_skill.weight.category">
- <field name="name">years</field>
- </record>
-
-<!-- <record id="stock_inventory_line_13" model="stock.inventory.line"> -->
-<!-- <field name="product_id" model="product.product" search="[('default_code','=','TOW1')]"/> -->
-<!-- <field name="product_uom" model="product.uom" search="[('name','=','Unit')]"/> -->
-<!-- <field name="inventory_id" ref="stock_inventory_0"/> -->
-<!-- <field name="product_qty">7.0</field> -->
-<!-- <field name="location_id" model="stock.location" search="[('name','=','Components')]"/> -->
-<!-- </record> -->
-
-
-</data>
-</terp>
diff --git a/addons/hr_skill/hr_skill_report.xml b/addons/hr_skill/hr_skill_report.xml
deleted file mode 100644
index 0aa950f13ec..00000000000
--- a/addons/hr_skill/hr_skill_report.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<terp>
-<data>
- <report
- id="report_evaluation"
- string="Evaluation report"
- model="hr_skill.evaluation"
- name="hr_skill.evaluation.report"
- rml="hr_skill/report/evaluation.rml"/>
-
-
-</data>
-</terp>
-
-
diff --git a/addons/hr_skill/hr_skill_view.xml b/addons/hr_skill/hr_skill_view.xml
deleted file mode 100644
index 081dad7959d..00000000000
--- a/addons/hr_skill/hr_skill_view.xml
+++ /dev/null
@@ -1,354 +0,0 @@
-<terp>
-<data>
-
- <menuitem name="Human Resources/Configuration/Skills Management" groups="admin"/>
-
-<!-- defini le formulaire skill -->
- <record model="ir.ui.view" id="view_skill_form">
- <field name="name">hr_skill.skill.form</field>
- <field name="model">hr_skill.skill</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Skills">
- <field name="name" select="1" colspan="1"/>
- <field name="active" select="1" />
- <newline/>
- <field name="parent_id" select="1"/>
- <field name="weight_category_id" select="1"/>
- <field name="view" select="1"/>
- </form>
- </field>
- </record>
-<!-- defini une action pr skill ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_skill_form">
- <field name="res_model">hr_skill.skill</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree skill ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Skills" id="menu_open_view_skill_form" action="open_view_skill_form"/>
-
-
-
-<!-- defini la vue en arbre des skills-->
- <record model="ir.ui.view" id="view_hr_skill_tree">
- <field name="name">hr_skill.skill.tree</field>
- <field name="model">hr_skill.skill</field>
- <field name="type">tree</field>
- <field name="field_parent">child_ids</field>
- <field name="arch" type="xml">
- <tree string="Skills">
- <field name="name"/>
- <field name="view"/>
- </tree>
- </field>
- </record>
-<!-- associe la vue en arbre des skills au bouton correspondant ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_skill_tree">
- <field name="name">Skills structure</field>
- <field name="res_model">hr_skill.skill</field>
- <field name="view_type">tree</field>
- <field name="view_id" ref="view_hr_skill_tree"/>
- <field name="domain">[('parent_id','=',False)]</field>
- </record>
-<!-- ajoute une entree "skill tree" dans le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Skills Structure" id="menu_open_view_skill_tree" action="open_view_skill_tree"/>
-
-
-
-
-<!-- defini le formulaire position -->
- <record model="ir.ui.view" id="view_position_form">
- <field name="name">hr_skill.position.form</field>
- <field name="model">hr_skill.position</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Positions">
- <field name="name" select="1" colspan="4"/>
- <field name="profile_ids" colspan="4">
- <tree string="Profiles" editable="top">
- <field name="profile_id" on_change="onchange_profile_id(profile_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </tree>
- </field>
- </form>
- </field>
- </record>
-<!-- defini une action pr position ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_position_form">
- <field name="res_model">hr_skill.position</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree position ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Positions" id="menu_open_view_position_form" action="open_view_position_form"/>
-
-
-
-<!-- defini le formulaire profile -->
- <record model="ir.ui.view" id="view_profile_form">
- <field name="name">hr_skill.profile.form</field>
- <field name="model">hr_skill.profile</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Profile">
- <field name="name" select="1" colspan="4"/>
- <field name="skill_ids" colspan="4">
- <tree string="Skills" editable="top">
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </tree>
- <form string="Skills" editable="top">
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </form>
-
- </field>
- </form>
- </field>
-
- </record>
-<!-- defini une action pr profile ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_profile_form">
- <field name="res_model">hr_skill.profile</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree profiles ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Profiles" id="menu_open_view_profiles_form" action="open_view_profile_form"/>
-
-
-
-<!-- defini le formulaire weight categories -->
- <record model="ir.ui.view" id="view_weight_category_form">
- <field name="name">hr_skill.weight.category.form</field>
- <field name="model">hr_skill.weight.category</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Weight Categories">
- <field name="name" select="1" colspan="2"/>
- </form>
- </field>
- </record>
-<!-- defini une action pr weight categories ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_weight_category_form">
- <field name="res_model">hr_skill.weight.category</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree weight categories ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Weight Categories" id="menu_open_view_weight_category_form" action="open_view_weight_category_form"/>
-
-
-<!-- defini le formulaire weight -->
- <record model="ir.ui.view" id="view_weight_form">
- <field name="name">hr_skill.weight.form</field>
- <field name="model">hr_skill.weight</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Weight">
- <field name="name" select="1"/>
- <newline/>
- <field name="value" select="1"/>
- <field name="category_id" select="1"/>
- </form>
- </field>
-
- </record>
-<!-- defini une action pr weight categories ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_weight_form">
- <field name="res_model">hr_skill.weight</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree weight categories ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Weights" id="menu_open_view_weight_form" action="open_view_weight_form"/>
-
-
-
-
-
-
-
-<!-- defini le formulaire experience categories -->
- <record model="ir.ui.view" id="view_experience_category_form">
- <field name="name">hr_skill.experience.category.form</field>
- <field name="model">hr_skill.experience.category</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Experience Categories">
- <field name="name" select="1" colspan="2"/>
- </form>
- </field>
- </record>
-<!-- defini une action pr experience categories ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_experience_category_form">
- <field name="res_model">hr_skill.experience.category</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree experience categories ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Experience Categories" id="menu_open_view_experience_category_form" action="open_view_experience_category_form"/>
-
-
-
-
-<!-- defini le formulaire experience -->
- <record model="ir.ui.view" id="view_experience_form">
- <field name="name">hr_skill.experience.form</field>
- <field name="model">hr_skill.experience</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Experiences">
- <field name="name" select="1" />
- <field name="category_id" select="1" />
- <field name="skill_ids" colspan="4">
- <tree string="Skills" editable="top">
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </tree>
- <form string="Skills" editable="top">
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </form>
-
- </field>
- </form>
- </field>
- </record>
-<!-- defini une action pr position ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_experience_form">
- <field name="res_model">hr_skill.experience</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree position ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Experiences" id="menu_open_view_experience_form" action="open_view_experience_form"/>
-
-
-
-
-<!-- formulaire evaluation -->
- <record model="ir.ui.view" id="view_evalutation_form">
- <field name="name">hr_skill.evaluation.form</field>
- <field name="model">hr_skill.evaluation</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
-
- <form string="Evaluation">
- <notebook>
- <page string="General Informations">
-
- <field name="name" select="1"/>
- <field name="date" select="1"/>
- <field name="interviewee_name" select="1"/>
- <field name="interviewer_name" select="1"/>
- <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
- <field name="reference" />
- <field name="category_id" />
- <field name="note" colspan="4"/>
-
-
- </page>
- <page string="Skill and experiences">
- <field name="experience_ids" colspan="4" nolanel="1">
- <tree string="Experiences"
- editable="top" nolabel="1" >
- <field name="experience_id" on_change="onchange_experience_id(experience_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </tree>
- </field>
- <field name="skill_ids" colspan="4" nolanel="1">
- <tree string="Skills"
- editable="top" nolabel="1" >
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- <field name="weight_id"/>
- <field name="name"/>
- </tree>
- </field>
-
- </page>
- </notebook>
- </form>
- </field>
- </record>
-
-
-
-<!-- arbre evaluation -->
- <record model="ir.ui.view" id="view_evalutation_tree">
- <field name="name">hr_skill.evaluation.tree</field>
- <field name="model">hr_skill.evaluation</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Evaluation">
- <field name="name" select="1"/>
- <field name="date" select="1"/>
- <field name="interviewee_name" select="1"/>
- <field name="interviewer_name" select="1"/>
- <field name="category_id" />
- </tree>
- </field>
- </record>
-
-
-
-<!-- defini une action pr evaluation ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_evaluation_form">
- <field name="res_model">hr_skill.evaluation</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree evaluations ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Management/Evaluations" id="menu_open_view_evaluation_form" action="open_view_evaluation_form"/>
-
- <act_window name="Skill weight"
- domain="[('category_id', '=', active_id)]"
- res_model="hr_skill.weight"
- src_model="hr_skill.weight.category"
- id="act_hr_skill_weight_category_2_hr_skill_weight"/>
-
-
-</data>
-</terp>
-
-
-
-
-
-<!-- complete le formulaire employee -->
-<!-- <record model="ir.ui.view" id="view_hr_employe"> -->
-<!-- <field name="name">hr_skill.employee.inherit.form</field> -->
-<!-- <field name="model">hr.employee</field> -->
-<!-- <field name="inherit_id" ref="hr.view_employee_form" /> -->
-<!-- <field name="type">form</field> -->
-<!-- <field name="priority" eval="64"/> -->
-<!-- <field name="arch" type="xml"> -->
-<!-- <page string="Holidays" position="after"> -->
-<!-- <page string="Skills"> -->
-<!-- <field -->
-<!-- name="experience_ids"> -->
-<!-- <form string="Employee experience"> -->
-<!-- <field name="name"/> -->
-<!-- <field name="experience_id" on_change="onchange_experience_id(experience_id)"/> -->
-<!-- <field name="weight_id" /> -->
-<!-- </form> -->
-<!-- <tree string="Employee experience" editable="top"> -->
-<!-- <field name="name" /> -->
-<!-- <field name="experience_id" on_change="onchange_experience_id(experience_id)"/> -->
-<!-- <field name="weight_id" /> -->
-<!-- </tree> -->
-
-
-<!-- </field> -->
-<!-- <field name="skill_ids" /> -->
-<!-- </page> -->
-<!-- </page> -->
-<!-- </field> -->
-<!-- </record> -->
diff --git a/addons/hr_skill/old-hr_skill.skill.csv b/addons/hr_skill/old-hr_skill.skill.csv
deleted file mode 100644
index 6d3489adaec..00000000000
--- a/addons/hr_skill/old-hr_skill.skill.csv
+++ /dev/null
@@ -1,12 +0,0 @@
-name,view,parent_id,
-Latin,view,Lang,
-Français,skill,Latin,
-IT,view,,
-NL,skill,Germanique,
-DE,skill,Germanique,
-Lang,view,,
-Network,skill,IT,
-Development,view,IT,
-Python,skill,Development,
-Erlang,skill,Development,
-Germanique,view,Lang, \ No newline at end of file
diff --git a/addons/hr_skill/old-hr_skill_view.xml b/addons/hr_skill/old-hr_skill_view.xml
deleted file mode 100644
index 2deac62d27e..00000000000
--- a/addons/hr_skill/old-hr_skill_view.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<terp>
-<data>
-
-<!-- defini le formulaire skill -->
- <record model="ir.ui.view" id="view_skill_form">
- <field name="name">hr_skill.skill.form</field>
- <field name="model">hr_skill.skill</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Skills">
- <field name="name" select="1" colspan="4"/>
- <field name="parent_id" select="1"/>
- <field name="view" select="1"/>
- <field name="child_ids" colspan="4"/>
- </form>
- </field>
- </record>
-<!-- defini une action pr skill ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_skill_form">
- <field name="name">hr_skill.skill</field>
- <field name="res_model">hr_skill.skill</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree skill ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills" id="menu_open_view_skill_form" action="open_view_skill_form"/>
-
-
-
-<!-- defini la vue en arbre des skills-->
- <record model="ir.ui.view" id="view_hr_skill_tree">
- <field name="name">hr_skill.skill.tree</field>
- <field name="model">hr_skill.skill</field>
- <field name="type">tree</field>
- <field name="field_parent">child_ids</field>
- <field name="arch" type="xml">
- <tree string="Skills">
- <field name="name"/>
- <field name="view"/>
- </tree>
- </field>
- </record>
-<!-- associe la vue en arbre des skills au bouton correspondant ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_skill_tree">
- <field name="name">hr_skill.skill.tree</field>
- <field name="res_model">hr_skill.skill</field>
- <field name="view_type">tree</field>
- <field name="view_id" ref="view_hr_skill_tree"/>
- <field name="domain">[('parent_id','=',False)]</field>
- </record>
-<!-- ajoute une entree "skill tree" dans le menu principal -->
- <menuitem name="Human Resources/Configuration/Skills Structure" id="menu_open_view_skill_tree" action="open_view_skill_tree"/>
-
-
-
-
-<!-- defini le formulaire position -->
- <record model="ir.ui.view" id="view_position_form">
- <field name="name">hr_skill.position.form</field>
- <field name="model">hr_skill.position</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Positions">
- <field name="name" select="1" colspan="4"/>
- <field name="profile_ids" colspan="4">
- <tree string="Profiles" editable="top">
- <field name="name"/>
- <field name="weight_id"/>
- <field name="profile_id" on_change="onchange_profile_id(profile_id)"/>
- </tree>
- </field>
- </form>
- </field>
- </record>
-<!-- defini une action pr position ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_position_form">
- <field name="name">hr_skill.position</field>
- <field name="res_model">hr_skill.position</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree position ds le menu principal -->
- <menuitem name="Human Resources/Configuration/Positions" id="menu_open_view_position_form" action="open_view_position_form"/>
-
-
-
-<!-- defini le formulaire profile -->
- <record model="ir.ui.view" id="view_profile_form">
- <field name="name">hr_skill.profile.form</field>
- <field name="model">hr_skill.profile</field>
- <field name="type">form</field>
- <field name="view_mode">form,tree</field>
- <field name="arch" type="xml">
- <form string="Profile">
- <field name="name" select="1" colspan="4"/>
- <field name="skill_ids" colspan="4">
- <tree string="Skills" editable="top">
- <field name="name"/>
- <field name="weight_id"/>
- <field name="skill_id" on_change="onchange_skill_id(skill_id)"/>
- </tree>
- </field>
- </form>
- </field>
-
- </record>
-<!-- defini une action pr profile ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_profile_form">
- <field name="name">hr_skill.profile</field>
- <field name="res_model">hr_skill.profile</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree profiles ds le menu principal -->
- <menuitem
- name="Human Resources/Configuration/Profiles"
- id="menu_open_view_profiles_form"
- action="open_view_profile_form"/>
-
-
-
-<!-- defini le formulaire weight -->
- <record model="ir.ui.view" id="view_weight_category_form">
- <field name="name">hr_skill.weight_category.form</field>
- <field name="model">hr_skill.weight_category</field>
- <field name="type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini une action pr profile ds le menu principal -->
- <record model="ir.actions.act_window" id="open_view_weight_category_form">
- <field name="name">hr_skill.weight_category</field>
- <field name="res_model">hr_skill.weight_category</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- </record>
-<!-- defini l'entree profiles ds le menu principal -->
- <menuitem
- name="Human Resources/Configuration/Weight Wategories"
- id="menu_open_view_weight_category_form"
- action="open_view_weight_category_form"/>
-
-
-
-
-
-
-</data>
-</terp>
diff --git a/addons/hr_skill/report/evaluation.rml b/addons/hr_skill/report/evaluation.rml
deleted file mode 100644
index cfc9e250c9c..00000000000
--- a/addons/hr_skill/report/evaluation.rml
+++ /dev/null
@@ -1,192 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- <blockBackground colorName="#c0c0c0" start="0,0" stop="0,0"/>
- <blockBackground colorName="#c0c0c0" start="1,0" stop="1,0"/>
- <blockBackground colorName="#c0c0c0" start="2,0" stop="2,0"/>
- <blockBackground colorName="#c0c0c0" start="0,1" stop="0,1"/>
- <blockBackground colorName="#c0c0c0" start="1,1" stop="1,1"/>
- <blockBackground colorName="#c0c0c0" start="2,1" stop="2,1"/>
- </blockTableStyle>
- <blockTableStyle id="Table1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- <blockBackground colorName="#c0c0c0" start="0,0" stop="0,0"/>
- <blockBackground colorName="#c0c0c0" start="1,0" stop="1,0"/>
- <blockBackground colorName="#c0c0c0" start="2,0" stop="2,0"/>
- <blockBackground colorName="#c0c0c0" start="0,1" stop="0,1"/>
- <blockBackground colorName="#c0c0c0" start="1,1" stop="1,1"/>
- <blockBackground colorName="#c0c0c0" start="2,1" stop="2,1"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Helvetica-Bold" fontSize="13.0" leading="16" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="P2" fontName="Times-Roman"/>
- <paraStyle name="P3" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="P4" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P5" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="Standard" fontName="Times-Roman"/>
- <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman"/>
- <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
- </stylesheet>
- <story>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Heading 1">Evaluation Report</para>
- <para style="P1">Evaluated Peoples :</para>
- <section>
- <para style="Standard">
- <font face="Times-Roman">[[ repeatIn(objects, 'o') ]] </font>
- </para>
- <para style="P2"><font face="Times-Roman">  •  </font>[[o.interviewee_name ]]</para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </section>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <section>
- <para style="Standard">
- <font face="Times-Roman">[[ repeatIn(objects, 'o') ]]</font>
- </para>
- <para style="P3">
- <font face="Times-Roman">Evaluated people : [[ o.interviewee_name ]]</font>
- </para>
- <blockTable colWidths="161.0,161.0,161.0" repeatRows="1" style="Tableau2">
- <tr>
- <td>
- <para style="Table Heading">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="Table Heading">Experiences</para>
- </td>
- <td>
- <para style="Table Heading">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="Table Heading">Expérience</para>
- </td>
- <td>
- <para style="Table Heading">level</para>
- </td>
- <td>
- <para style="Table Heading">Note</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="Table Contents"><font face="Times-Roman" size="10.0">[[repeatIn(o.experience_ids, 'e') ]]</font> [[ e.experience_id.name ]] </para>
- </td>
- <td>
- <para style="Table Contents">[[ e.weight_id.name ]]</para>
- </td>
- <td>
- <para style="Table Contents">[[ e.name ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="161.0,161.0,161.0" style="Table1">
- <tr>
- <td>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="P4">Specific skills</para>
- </td>
- <td>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P4">Skill</para>
- </td>
- <td>
- <para style="P4">Level</para>
- </td>
- <td>
- <para style="P4">Note</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="Table Contents"><font face="Times-Roman" size="10.0">[[repeatIn(o.skill_ids, 's') ]]</font> [[ s.name ]] </para>
- </td>
- <td>
- <para style="Table Contents">[[ s.weight_id.name ]]</para>
- </td>
- <td>
- <para style="Table Contents">[[ s.name ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="P5">
- <font face="Times-Roman"/>
- </para>
- </section>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </story>
-</document>
-
diff --git a/addons/hr_timesheet_ical/__init__.py b/addons/hr_timesheet_ical/__init__.py
deleted file mode 100644
index 81701a020ec..00000000000
--- a/addons/hr_timesheet_ical/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
diff --git a/addons/hr_timesheet_ical/__terp__.py b/addons/hr_timesheet_ical/__terp__.py
deleted file mode 100644
index b1d5e3bb7f6..00000000000
--- a/addons/hr_timesheet_ical/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "Complete timesheet from an iCal server",
- "version" : "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Human Resources",
- "website" : "http://tinyerp.com/module_hr.html",
- "description": "Import iCal events (for eg, Outlook) to auto-complete timesheets.",
- "depends" : ["hr_timesheet"],
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["hr_timesheet_wizard.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/hr_timesheet_ical/hr_timesheet_wizard.xml b/addons/hr_timesheet_ical/hr_timesheet_wizard.xml
deleted file mode 100644
index 0d3f9e39a15..00000000000
--- a/addons/hr_timesheet_ical/hr_timesheet_wizard.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <wizard id="ical_import" name="hr.ical_import" string="Import iCalendar" model="hr.employee" />
- <menuitem id="ical_import_menu" name="Human Resources/Hours Encoding/Import Icalendar" type="wizard" action="ical_import" />
- </data>
-</terp>
diff --git a/addons/hr_timesheet_ical/wizard/__init__.py b/addons/hr_timesheet_ical/wizard/__init__.py
deleted file mode 100644
index be20cb4be54..00000000000
--- a/addons/hr_timesheet_ical/wizard/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sys
-if sys.version_info[:1] >= (2, 4):
- import wizard_ical.py
-
diff --git a/addons/hr_timesheet_ical/wizard/urllib2.py b/addons/hr_timesheet_ical/wizard/urllib2.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/hr_timesheet_ical/wizard/urllib2.py
+++ /dev/null
diff --git a/addons/hr_timesheet_ical/wizard/wizard_ical.py b/addons/hr_timesheet_ical/wizard/wizard_ical.py
deleted file mode 100644
index d4ed4e2d824..00000000000
--- a/addons/hr_timesheet_ical/wizard/wizard_ical.py
+++ /dev/null
@@ -1,130 +0,0 @@
-import re
-import urllib2
-import datetime
-from schoolbell.calendar import icalendar
-
-import wizard
-import pooler
-
-CALENDAR_URL = 'http://127.0.0.1:7180'
-
-def _employee_get(self,cr,uid,context={}):
- ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
- if ids:
- return ids[0]
- return False
-
-class RequestHandler(object):
-
- def __init__(self):
- self.auth_handler = urllib2.HTTPBasicAuthHandler()
- self.opener = urllib2.build_opener(self.auth_handler)
-
- def addAuthentication(self, username, password):
- self.auth_handler.add_password('zope', CALENDAR_URL, username, password)
-
-def get_url(url, auth_data={}):
- req = RequestHandler()
- if auth_data:
- req.addAuthentication(auth_data['user'], auth_data['pass'])
- return req.opener.open(url).read()
-
-def _start_date(uid, y, z):
- today = datetime.date.today()
- monday = today - datetime.timedelta(days=today.weekday())
- return monday.strftime('%Y-%m-%d')
-
-def _end_date(uid, y, z):
- today = datetime.date.today()
- friday = today + datetime.timedelta(days=4-today.weekday())
- return friday.strftime('%Y-%m-%d')
-
-ical_form = """<?xml version="1.0" ?>
-<form string="Chose the dates">
- <field name="startdate" />
- <field name="enddate" />
- <field name="user_id" colspan="3"/>
-</form>"""
-
-ical_fields = {
- 'startdate' : dict(string='Start date', type='date', required=True, default=_start_date),
- 'enddate' : dict(string='End date', type='date', required=True, default=_end_date),
- 'user_id' : dict(string=u'User', type='many2one', relation='res.users', required=True, default=lambda x,y,z:x),
- }
-
-success_form = """<?xml version="1.0" ?>
-<form string="Import successful">
- <separator string="Import successful" />
-</form>"""
-
-success_fields = {}
-
-project_re = re.compile(r"^ *\[?(\d{1,4}\.?\d{0,3})\]? *(.*)", re.UNICODE)
-
-class wizard_import_icalendar(wizard.interface):
- def import_ical(self, cr, uid, data, context):
- employee_id = _employee_get(pooler.get_pool(cr.dbname).get('hr.attendance'), cr, data['form']['user_id'])
- if not employee_id:
- raise wizard.except_wizard('No employee found for the user', 'Login ID: %s' % data['form']['user_id'])
-
- first, end = [datetime.date(*(map(int, x.split('-')))) for x in [data['form']['startdate'], data['form']['enddate']]]
- end = min(end, datetime.date.today())
- try:
- user_obj = pooler.get_pool(cr.dbname).get('res.users')
- user = user_obj.read(cr, uid, [data['form']['user_id']])
- events = icalendar.read_icalendar(get_url('%s/persons/%s/calendar.ics' % (CALENDAR_URL, user[0]['login']), {'user': 'manager', 'pass': 'schoolbell'}))
- except urllib2.HTTPError, e:
- raise wizard.except_wizard('Erreur HTTP', '%s - %s' % (e.code, e.msg))
- except IndexError:
- raise wizard.except_wizard('No user login found', 'Login ID: %s' % data['form']['user_id'])
-
- event_obj = pooler.get_pool(cr.dbname).get('res.partner.event')
- timesheet_line_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
- analytic_account_obj = pooler.get_pool(cr.dbname).get('account.analytic.account')
- for event in [e for e in events if first <= e.dtstart.date() <= end]:
- project_search = project_re.search(event.title)
- if not project_search:
- continue
- else:
- project_code, summary = project_search.groups()
-
- account_id = analytic_account_obj.name_search(cr, uid, project_code)
- if account_id:
- account_id = account_id[0][0]
- timesheet_line_id = timesheet_line_obj.search(cr, uid, [('event_ical_id', '=', event.unique_id)])
- if not timesheet_line_id:
- unit_id = timesheet_line_obj.default_get(cr, uid, ['product_uom_id','product_id'], {'user_id' : data['form']['user_id']})
- amount = timesheet_line_obj.on_change_unit_amount(cr, uid, [], unit_id['product_id'], event.duration.seconds / 3600.0, unit_id['product_uom_id'])
- if amount:
- amount = amount['value']['amount']
- timesheet_line_obj.create(cr, uid, {'name' : summary, 'date' : event.dtstart.strftime('%Y-%m-%d'), 'unit_amount' : event.duration.seconds / 3600.0,
- 'user_id' :vdata['form']['user_id'], 'account_id' : account_id, 'amount' : amount,
- 'event_ical_id' : event.unique_id},
- {'user_id' : data['form']['user_id']})
-
- event_id = event_obj.search(cr, uid, [('event_ical_id', '=', event.unique_id)])
- if not event_id:
- account = pooler.get_pool(cr.dbname).get('account.analytic.account').read(cr, uid, [account_id], ['partner_id', 'contact_id'])
- if account:
- event_obj.create(cr, uid,
- {'name' : summary,
- 'description' : event.description,
- 'partner_id' : account[0]['partner_id'][0],
- 'project_id' : account_id,
- 'user_id' : data['form']['user_id'],
- 'date' : event.dtstart.strftime('%Y-%m-%d %H:%M'),
- 'event_ical_id' : event.unique_id})
- return {}
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'form', 'arch' : ical_form, 'fields' : ical_fields, 'state' : (('import', 'Import'), ('end', 'Cancel'))}
- },
- 'import' : {
- 'actions' : [import_ical],
- 'result' : {'type' : 'form', 'arch' : success_form, 'fields' : success_fields, 'state' : (('end', 'Quit'),)}
- },
- }
-
-wizard_import_icalendar('hr.ical_import')
diff --git a/addons/letter/__init__.py b/addons/letter/__init__.py
deleted file mode 100644
index 7749244b347..00000000000
--- a/addons/letter/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import letter
-import wizard
-import report
diff --git a/addons/letter/__terp__.py b/addons/letter/__terp__.py
deleted file mode 100644
index 531bef1b337..00000000000
--- a/addons/letter/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "Letters and automatic contracts",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Others",
- "depends" : ["base"],
- "description": """Module to automate the creation of document. You design your templates in Open Office and this module allows you to configure them.""",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["letter_report.xml","letter_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/letter/letter.py b/addons/letter/letter.py
deleted file mode 100644
index 45ba91469a3..00000000000
--- a/addons/letter/letter.py
+++ /dev/null
@@ -1,97 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# $Id: letter.py 1304 2005-09-08 14:35:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv, orm
-import time
-import tools
-import pooler
-
-
-class letter_paragraph_type(osv.osv):
- _name = "letter.paragraph.type"
- _columns = {
- 'name': fields.char('Paragraph Type', size=60, required=True),
- 'sequence': fields.integer('Sequence', required=True),
- }
-letter_paragraph_type()
-
-class letter_paragraph(osv.osv):
- _name = "letter.paragraph"
- _columns = {
- 'name': fields.char('Paragraph Name', size=60, required=True),
- 'sequence': fields.integer('Sequence'),
- 'type_id': fields.many2one('letter.paragraph.type', 'Paragraph Type'),
- 'content': fields.text('Content'),
- }
-letter_paragraph()
-
-class letter_letter_type(osv.osv):
- _name = "letter.letter.type"
- _columns = {
- 'name': fields.char('Name', size=60, required=True),
- 'template': fields.selection([('default','Default Template')], 'Template', required=True),
- 'paragraph_ids': fields.many2many('letter.paragraph', 'letter_letter_paragraph_rel', 'letter_id','paragraph_id', 'Defaults Paragraphs')
- }
-letter_letter_type()
-
-class letter_letter(osv.osv):
- _name = "letter.letter"
- _columns = {
- 'name': fields.char('Name', size=60, required=True),
- 'partner_id': fields.many2one('res.partner', 'Partner', required=True),
- 'type_id': fields.many2one('letter.letter.type', 'Letter Type', required=True),
- 'state': fields.selection([('draft', 'Draft'),('confirmed','Confirmed')], 'State', required=True),
- 'paragraph_ids': fields.one2many('letter.letter.paragraph','letter_id', 'Letter')
- }
- _defaults = {
- 'state': lambda *a: 'draft',
- }
-
- def onchange_type_id(self, cr, uid, ids, type_id):
- if type_id:
- letter = pooler.get_pool(cr.dbname).get('letter.letter.type').browse(cr, uid, type_id)
- return {'value':{'paragraph_ids': [x.id for x in letter.paragraph_ids]}}
- else:
- return {'value':{'paragraph_ids': []}}
-
-letter_letter()
-
-class letter_letter_paragraph(osv.osv):
- _name = "letter.letter.paragraph"
- _columns = {
- 'sequence': fields.integer('Sequence'),
- 'name': fields.char('Paragraph Name', size=60, required=True),
- 'letter_id': fields.many2one('letter.letter', 'Letter'),
- 'type_id': fields.many2one('letter.paragraph.type', 'Paragraph Type'),
- 'content': fields.text('Content'),
- }
-letter_letter_paragraph()
-
-
diff --git a/addons/letter/letter_data.xml b/addons/letter/letter_data.xml
deleted file mode 100644
index ff4e70b2990..00000000000
--- a/addons/letter/letter_data.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <record model="letter.paragraph.type" id="keys">
- <field name="name">keys</field>
- <field name="sequence" eval="1"/>
- </record>
- <record model="letter.paragraph.type" id="modules">
- <field name="name">modules</field>
- <field name="sequence" eval="1"/>
- </record>
- <record model="letter.paragraph.type" id="specific">
- <field name="name">specific</field>
- <field name="sequence" eval="1"/>
- </record>
- <record model="letter.paragraph.type" id="price">
- <field name="name">price</field>
- <field name="sequence" eval="1"/>
- </record>
- </data>
-</terp>
-
diff --git a/addons/letter/letter_report.xml b/addons/letter/letter_report.xml
deleted file mode 100644
index 32382b713b8..00000000000
--- a/addons/letter/letter_report.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <report string="Letter" model="letter.letter" name="letter.letter" auto="False" id="letter_letter"/>
-
- </data>
-</terp>
-
diff --git a/addons/letter/letter_view.xml b/addons/letter/letter_view.xml
deleted file mode 100644
index d38b41bbad6..00000000000
--- a/addons/letter/letter_view.xml
+++ /dev/null
@@ -1,173 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
- <record model="ir.ui.view" id="letter_letter_type_form">
- <field name="model">letter.letter.type</field>
- <field name="name">letter.letter.type.view</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Letter Type">
- <field name="name" colspan="4" select="1"/>
- <field name="template" select="1"/>
- <field name="paragraph_ids" colspan="4"/>
- </form>
- </field>
- </record>
-
- <wizard string="Load Paragraphs" model="letter.letter" name="letter.paragraph.load" id="wizard_letter_paragraph_load"/>
-
- <record model="ir.ui.view" id="letter_letter_form">
- <field name="model">letter.letter</field>
- <field name="name">letter.letter.view</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Letter">
- <field name="name" colspan="4" select="1"/>
- <field name="partner_id" select="1"/>
- <field name="type_id" on_change="onchange_type_id(type_id)"/>
- <newline/>
- <field name="paragraph_ids" colspan="4" widget="one2many_list"/>
- <separator string="States" colspan="4"/>
- <field name="state" select="1"/>
- <group col="2" colspan="2">
- <button name="%(wizard_letter_paragraph_load)d" string="Load Paragraphs" type="action"/>
- </group>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_letter_form">
- <field name="res_model">letter.letter</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="letter_letter_form"/>
- </record>
- <menuitem name="Tools/Letters/Letters" id="menu_action_letter_form" action="action_letter_form"/>
-
- <record model="ir.actions.act_window" id="action_letter_form_draft">
- <field name="name">Draft Letters</field>
- <field name="res_model">letter.letter</field>
- <field name="type">ir.actions.act_window</field>
- <field name="domain">[('state','=','draft')]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Letters/Letters/Draft Letters" id="menu_action_letter_form_draft" action="action_letter_form_draft"/>
- <record model="ir.actions.act_window" id="action_letter_form_confirm">
- <field name="name">Confirmed Letters</field>
- <field name="res_model">letter.letter</field>
- <field name="type">ir.actions.act_window</field>
- <field name="domain">[('state','=','confirmed')]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Letters/Letters/Confirmed Letters" id="menu_action_letter_form_confirm" action="action_letter_form_confirm"/>
-
- <record model="ir.ui.view" id="view_letter_paragraph_tree">
- <field name="model">letter.letter.paragraph</field>
- <field name="name">letter.letter.paragraph.tree</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Letter Paragraph">
- <field name="sequence"/>
- <field name="name"/>
- <field name="type_id"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_letter_paragraph_form">
- <field name="model">letter.letter.paragraph</field>
- <field name="name">letter.letter.paragraph.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Letter Paragraph">
- <field name="name" select="1" colspan="4"/>
- <field name="sequence"/>
- <field name="type_id"/>
- <field name="content" colspan="4" widget="text_tag"/>
- </form>
- </field>
- </record>
-
- #
- # Configuration
- #
-
- <record model="ir.ui.view" id="view_paragraph_form">
- <field name="model">letter.paragraph</field>
- <field name="name">letter.paragraph.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Letter Paragraph">
- <field name="name" select="1" colspan="4"/>
- <field name="type_id" select="1"/>
- <field name="sequence"/>
- <field name="content" colspan="4" widget="text_tag"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_paragraph_form">
- <field name="res_model">letter.paragraph</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Letters/Configuration" groups="admin" sequence="1"/>
- <menuitem name="Tools/Letters/Configuration/Paragraphs" id="menu_action_paragraph_form" action="action_paragraph_form"/>
-
-
- <record model="ir.ui.view" id="view_letter_type_form">
- <field name="model">letter.letter.type</field>
- <field name="name">letter.letter.type.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Letter type">
- <field name="name"/>
- <field name="template" />
- <field name="paragraph_ids" colspan="4"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_letter_type_form">
- <field name="res_model">letter.letter.type</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Letters/Configuration/Letter Type" id="menu_action_letter_type_form" action="action_letter_type_form"/>
-
-
- <record model="ir.ui.view" id="view_paragraph_type_tree">
- <field name="model">letter.paragraph.type</field>
- <field name="name">letter.paragraph.type.tree</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Paragraph Type">
- <field name="sequence"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_paragraph_type_form">
- <field name="model">letter.paragraph.type</field>
- <field name="name">letter.paragraph.type.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Paragraph Type">
- <field name="name" select="1"/>
- <field name="sequence"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_paragraph_type_form">
- <field name="res_model">letter.paragraph.type</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Letters/Configuration/Paragraphs Type" id="menu_action_paragraph_type_form" action="action_paragraph_type_form"/>
-
-</data>
-</terp>
diff --git a/addons/letter/report/__init__.py b/addons/letter/report/__init__.py
deleted file mode 100644
index f6f1e7b7aa7..00000000000
--- a/addons/letter/report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import letter
diff --git a/addons/letter/report/custom_default.xsl b/addons/letter/report/custom_default.xsl
deleted file mode 100644
index fdd31432829..00000000000
--- a/addons/letter/report/custom_default.xsl
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version = '1.0' encoding="utf-8"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <xsl:variable name="signature">Axair</xsl:variable>
- <xsl:variable name="title">Tiny ERP Report</xsl:variable>
- <xsl:variable name="leftMargin">1cm</xsl:variable>
- <xsl:variable name="rightMargin">1cm</xsl:variable>
- <xsl:variable name="topMargin">1cm</xsl:variable>
- <xsl:variable name="bottomMargin">1cm</xsl:variable>
- <xsl:variable name="pageSize">21cm,29.7cm</xsl:variable>
-
- <xsl:variable name="page_format">a4_letter</xsl:variable>
-
- <xsl:template name="first_page_frames">
- <frame id="column" x1="1.5cm" y1="1.5cm">
- <xsl:attribute name="width">
- <xsl:value-of select="595.27 - 85"/>
- </xsl:attribute>
- <xsl:attribute name="height">
- <xsl:value-of select="841.88 - 100"/>
- </xsl:attribute>
- </frame>
- </xsl:template>
-
- <xsl:template name="other_pages_frames">
- <frame id="column" x1="1.5cm" y1="1.5cm">
- <xsl:attribute name="width">
- <xsl:value-of select="/report/config/PageWidth - 85"/>
- </xsl:attribute>
- <xsl:attribute name="height">
- <xsl:value-of select="/report/config/PageHeight - 100"/>
- </xsl:attribute>
- </frame>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/addons/letter/report/custom_rml.xsl b/addons/letter/report/custom_rml.xsl
deleted file mode 100644
index afc8c3d9a92..00000000000
--- a/addons/letter/report/custom_rml.xsl
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version = '1.0' encoding="utf-8"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:template name="first_page_graphics_report"/>
- <xsl:template name="other_pages_graphics_report"/>
-
- <xsl:template name="rml">
- <document>
- <template author="Generated by Tiny ERP, Fabien Pinckaers">
- <xsl:attribute name="pageSize">
- <xsl:value-of select="$pageSize"/>
- </xsl:attribute>
-
- <xsl:attribute name="leftMargin">
- <xsl:value-of select="$leftMargin"/>
- </xsl:attribute>
-
- <xsl:attribute name="rightMargin">
- <xsl:value-of select="$rightMargin"/>
- </xsl:attribute>
-
- <xsl:attribute name="topMargin">
- <xsl:value-of select="$topMargin"/>
- </xsl:attribute>
-
- <xsl:attribute name="bottomMargin">
- <xsl:value-of select="$bottomMargin"/>
- </xsl:attribute>
-
- <xsl:attribute name="title">
- <xsl:value-of select="$title"/>
- </xsl:attribute>
-
- <pageTemplate id="first_page">
- <pageGraphics>
- <xsl:call-template name="first_page_graphics_report"/>
- </pageGraphics>
-
- <xsl:call-template name="first_page_frames"/>
- </pageTemplate>
-
- <pageTemplate id="other_pages">
- <pageGraphics>
- <xsl:call-template name="other_pages_graphics_report"/>
- </pageGraphics>
-
- <xsl:call-template name="other_pages_frames"/>
- </pageTemplate>
- </template>
-
- <stylesheet>
- <xsl:call-template name="stylesheet"/>
- </stylesheet>
-
- <story>
- <xsl:call-template name="story"/>
- </story>
-
- </document>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/addons/letter/report/letter.py b/addons/letter/report/letter.py
deleted file mode 100644
index 23ac6392d00..00000000000
--- a/addons/letter/report/letter.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*-encoding: iso8859-1 -*-
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import pooler
-from report.report_sxw import report_sxw
-
-report_sxw('report.letter.letter', 'letter.letter', 'addons/letter/report/letter.rml')
diff --git a/addons/letter/report/letter.rml b/addons/letter/report/letter.rml
deleted file mode 100644
index 0e736900a75..00000000000
--- a/addons/letter/report/letter.rml
+++ /dev/null
@@ -1,551 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="71.0" y1="71.0" width="453" height="700"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau4">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau3">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau5">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau6">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau7">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau8">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P2" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="RIGHT"/>
- <paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13"/>
- <paraStyle name="P4" fontName="Times-Bold" fontSize="28.0" leading="34" alignment="CENTER"/>
- <paraStyle name="P5" fontName="Times-Bold" fontSize="14.0" leading="17" alignment="CENTER"/>
- <paraStyle name="P6" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
- <paraStyle name="P7" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
- <paraStyle name="P8" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
- <paraStyle name="P9" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P10" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
- <paraStyle name="P11" fontName="Times-Bold" fontSize="12.0" leading="15"/>
- <paraStyle name="P12" rightIndent="0.0" leftIndent="35.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P13" rightIndent="0.0" leftIndent="35.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P14" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P15" rightIndent="0.0" leftIndent="35.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P16" rightIndent="0.0" leftIndent="0.0" fontName="Times-Bold" fontSize="12.0" leading="15"/>
- <paraStyle name="P17" fontName="Times-Bold" fontSize="12.0" leading="15"/>
- <paraStyle name="P18" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P19" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P20" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P21" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P22" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P23" fontName="Times-Bold" fontSize="12.0" leading="15"/>
- <paraStyle name="P24" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P25" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P26" rightIndent="0.0" leftIndent="35.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P27" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P28" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P29" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P30" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P31" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P32" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P33" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P34" rightIndent="0.0" leftIndent="35.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P35" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P36" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="10.0" leading="13"/>
- <paraStyle name="Standard" fontName="Times-Roman" fontSize="10.0" leading="13"/>
- <paraStyle name="Text body" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 1" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="List" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="Table Contents" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="Table Heading" fontName="Times-BoldItalic" fontSize="12.0" leading="15" alignment="CENTER"/>
- <paraStyle name="Caption" fontName="Times-Italic" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman" fontSize="10.0" leading="13"/>
- <paraStyle name="WW-Pr&#xE9;format&#xE9; HTML" fontName="Courier" fontSize="10.0" leading="13"/>
- <paraStyle name="title" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="14.0" spaceAfter="14.0"/>
- <paraStyle name="WW-Normal (Web)" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="14.0" spaceAfter="14.0"/>
- <paraStyle name="section" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="14.0" spaceAfter="14.0"/>
- <paraStyle name="subsection" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="14.0" spaceAfter="14.0"/>
- </stylesheet>
- <story>
- <para style="P1">[[ repeatIn(objects,'o') ]]</para>
- <!--blockTable colWidths="227.0,228.0" style="Tableau4">
- <tr>
- <td>
- <illustration height="41.0" width="171.0">
- <image x="0" y="0" file="100000000000019000000061E28EBAAD.png" height="41.0" width="171.0"/>
- </illustration>
- </td>
- <td>
- <illustration height="41.0" width="171.0">
- <image x="0" y="0" file="100000000000019000000061E28EBAAD.png" height="41.0" width="171.0"/>
- </illustration>
- </td>
- </tr>
- </blockTable-->
- <para style="P2">Paris, le 26 septembre 2005</para>
- <para style="P3">
- <font color="white"> </font>
- </para>
- <para style="P3">
- <font color="white"> </font>
- </para>
- <para style="P3">
- <font color="white"> </font>
- </para>
- <para style="P3">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="227.0,227.0" style="Tableau1">
- <tr>
- <td>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="Table Contents">[[ o.partner_id.name ]]</para>
- <para style="Table Contents">[[ o.partner_id.address and o.partner_id.address[0].name ]]</para>
- <para style="Table Contents">[[ o.partner_id.address and o.partner_id.address[0].zip ]] [[ o.partner_id.address and o.partner_id.address[0].city ]]</para>
- <para style="Table Contents">[[ o.partner_id.address and o.partner_id.address[0].country_id and o.partner_id.address[0].country_id.name ]]</para>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- <para style="Table Contents">Phone: </para>
- <para style="Table Contents">Mail:</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="332.0" repeatRows="1" style="Tableau2">
- <tr>
- <td>
- <para style="P4">Proposition Commerciale</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- <para style="P5">Projet: Intégration de Tiny ERP</para>
- <para style="P6">[[ o.partner_id.name ]]</para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P7">
- <font color="white"> </font>
- </para>
- <para style="P8">
- <font color="white"> </font>
- </para>
- <para style="P9">
- <font color="white"> </font>
- </para>
- <para style="P8">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="212.0,242.0" style="Tableau3">
- <tr>
- <td>
- <para style="Table Contents"><font face="Helvetica-Bold">Tiny sprl</font> – Editeur Tiny ERP </para>
- <para style="Table Contents">Rue du vieux château 21</para>
- <para style="Table Contents">B-1457 Walhain</para>
- <para style="Table Contents">Contact: Fabien Pinckaers</para>
- <para style="Table Contents">Mail: fp@tiny.be</para>
- <para style="Table Contents">Tel: (+32).10.68.94.39</para>
- </td>
- <td>
- <para style="Table Contents"><font face="Helvetica-Bold">Humans &amp; Diversity</font> – Intégrateur Tiny ERP</para>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- <para style="Table Contents">Contact: Michel Pannetier</para>
- <para style="Table Contents">Mail: </para>
- <para style="Table Contents">Tel: </para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font face="Times-Roman" size="12.0"/>
- </para>
- <para style="P10"><font face="Times-Roman">Notre référence</font>: PROP[[o.id]]</para>
- <para style="P9">
- <font color="white"> </font>
- </para>
- <para style="P11">Introduction</para>
- <para style="P9">
- <font color="white"> </font>
- </para>
- <para style="P9">Cette analyse comprend les points nécessaires au projet d'intégration de Tiny ERP:</para>
- <para style="P12" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Une étude de vos besoins</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'adaptation de Tiny ERP aux besoins (développements)</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Le paramétrage du logiciel et la récupération des données clients</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'intégration/l'installation sur site</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">La formation de un ou deux utilisateurs clés</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'assistance et les adaptations durant les premiers mois en production</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- <para style="P14">Cette analyse est une première approximation du travail nécessaire à votre besoin. Cette proposition n'est pas contractuelle et peut être revue suite à une analyse détaillée de votre cahier des charges.</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- <para style="P14">Pour plus d'informations sur notre produit, voyez les liens suivants:</para>
- <para style="P15" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Tiny ERP: http://tinyerp.com</para>
- <para style="P15" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">La socitété éditrice: http://tiny.be</para>
- <para style="P15" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Humans &amp; Diversity: http://hu-div.fr</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- <para style="P16">Chiffres clés</para>
- <para style="P16">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="454.0" style="Tableau5">
- <tr>
- [[ repeatIn(o.paragraph_ids, 'x') ]]
- <td>
- <para style="P14">[[ x.type_id and x.type_id.name=='keys' and x.content or removeParentNode('tr') ]]</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="P14">
- <font color="white"> </font>
- </para>
- <para style="P17">L'étude des besoins et prototype:</para>
- <para style="P18">
- <font color="white"> </font>
- </para>
- <para style="Text body">La première phase du projet est l'étude détaillée de vos besoins, cette étude a pour objectif:</para>
- <para style="P19" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">d'élaborer le planing exact</para>
- <para style="P19" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">d'étudier les besoins exacts (tous les rapports, tous les écrans)</para>
- <para style="P19" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">présenter une version du logicielle adaptée aux besoins (tous les écrans, rapports, ...)</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Au terme de cette étude, une version du logicielle avec tous les composants nécessaires sera présentée. Cette version comprend uniquement la couche de présentation (formulaires, listes, rapports, ...) et ne comprend pas encore la logique. A ce stade, le logiciel sera complêtement utilisable (tous les écrans seront développés) et une version sera installée chez [[ o.partner_id.name ]] pour contrôle. Nos outils de travail collaboratif (rédaction documentation, suivit des planing, ...) vous permettent de suivre et influencer le développement dès cette phase.</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">A ce stade nous vous présenterons le logiciel tel qu'il sera dans la version définitive; tous les formulaires seront fonctionnels: nomenclatures, BL, logiciels installés, sav, ... mais la logique sera développée/adaptée par la suite. Cette version sera entièrement utilisable.</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Cette méthode nous permet d'avoir un retour très rapide sur notre développement et de valider (ou non) dans les 2 semaines la conformité aux besoins.</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="P20">
- <font color="white"> </font>
- </para>
- <para style="P17">Adaptation du logiciel</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">La seconde étape est le développement de toute la couche fonctionnelle, de toutes les fonctionnalités du logiciel nécessaires à [[ o.partner_id.name ]]. Cette étape comprend les phases de validations et tests habituels. Un jeu de test complet sera également déployé.</para>
- <para style="P22">La rédaction de la documentation se fait également durant cette phase. Vous pourrez à tout moment bénéficier du logiciel intermédiaire pour contrôle de l'avancement.</para>
- <para style="P22">
- <font color="white"> </font>
- </para>
- <para style="P23">Paramétrage et importation des données</para>
- <para style="P22">
- <font color="white"> </font>
- </para>
- <para style="P22">Le paramétrage concerne principalement les fonctionnalités suivantes:</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l"><font face="Times-Roman">descriptions des comptes utilisés dans la compta</font>bilité.</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">les stocks (consignés, structure, ...)</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">les logiques de ventes et achats (validation si &gt;150 EUR, méthodes de paiements, ...)</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">les produits, catégories de produits, nomenclatures</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">importation du fichier client (+contacts et segmentations)</para>
- <para style="P24" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">gestion des utilisateurs/rôles/droits, désactivation de champs, ...</para>
- <para style="P22">
- <font color="white"> </font>
- </para>
- <para style="P22">Ce paramétrage n'est pas fixe et peu évoluer par la suite, ce n'est que le paramétrage à l'installation du programme.</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P17">Installation sur site</para>
- <para style="P22">
- <font color="white"> </font>
- </para>
- <para style="P22">Le serveur sera installé et fournit par nos soins. Il fonctionnera sous le système d'exploitation Debian (Linux) et comportera tous les outils nécessaire au bon fonctionnement de l'ERP; RAID 1 pour préserver les données en cas de problèmes hardware, des outils de backup incrémentaux, sécurisé, ... Une formation de l'administrateur système est prévue pour la gestion de ce système.</para>
- <para style="P22">
- <font color="white"> </font>
- </para>
- <para style="P22">Nous installerons également les clients. Tiny ERP fonctionne parfaitement sous Linux, Windows 2000, XP et systèmes supérieurs. Nous ne garantissons pas qu'il fonctionne sous les systèmes Windows 95, 98 et autres versions antérieures. (il fonctionne sur la plupart des Windows 98 que nous avons testés mais pas tous!)</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P25">Formations et assistance sur site</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">Un ou deux utilisateurs clés seront responsables chez [[ o.partner_id.name ]] de l'intégration du logiciel. Ces utilisateurs recevront nos formations à l'utilisation et au paramétrage des différents modules, avant installation. Durant les premières (1 à 4, selon le besoin) semaines qui suivent l'installation, un consultant/développeur de la société Tiny assistera les utilisateurs clés dans leur démarche ainsi que les débuts du logiciel en production.</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P25">Assistance après installation</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">Le présent devis comprend un support durant les 4 mois qui suivent l'installation. La couverture de ce support:</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">l'assistance à l'utilisation et au paramétrage</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">l'assistance à l'administration du serveur</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">la modification du paramétrage selon vos besoins</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">les adaptation mineures du logiciel à vos besoins: nouveaux rapports (max 20 nouveaux rapports), le paramétrage des modules, les adaptations mineures (modification de formulaires, changements des droits, modification de la logique, ...), modification d'ergonomie du logiciel.</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">la garantie de corriger les éventuels bugs ou non conformité empêchant l'utilisation du logiciel</para>
- <para style="P26" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">les interventions sur site en cas de besoins</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">Cette assistance ce comprend pas le développement de nouveaux modules ou de nouvelles fonctionnalités non énoncées dans le cahier des charges.</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P25">La couverture fonctionnelle du logiciel</para>
- <para style="P18">
- <font color="white"> </font>
- </para>
- <para style="P22">Notre objectif est de répondre aux besoins de [[ o.partner_id.name ]]. Il est donc possible que cette couverture soit étendue pour mieux répondre aux éventuels besoins détectés lors de la phase d'analyse détaillée.</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="454.0" style="Tableau6">
- <tr>
- [[ repeatIn(o.paragraph_ids, 'x') ]]
- <td>
- <para style="P14">[[ x.type_id and x.type_id.name=='modules' and x.content or removeParentNode('tr') ]]</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">CRM: gestion des clients/fournisseurs/prospects, segmentation, reporting, SMS, Mass mailing, gestion des départements (en arbre), suivit des événements clients, interface avec serveur mail pour intégrer Tiny ERP avec vos emails (CC: erp@emka.fr)</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Stock: gestion des stocks double entrée, SAV, stocks consignés, tenue des stocks des clients, vos stocks, automatisation des imputations comptables, tracabilité totale (fournisseur-&gt;client, interventions, fabrications, ...) Requêtes attachées à des états (stocks minimum, ...)</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Comptabilité: analytique, automatisée, double-entrée, multi-devises, multi-vues, PCG français</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Gestion des Produits: listes de prix, contrats, variantes de produits,</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Gestion des ventes: Devis, Suivi des commandes, pipeline des commerciaux, analyse des résultats, les flux de vente, ...</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="Text body">Gestion des achats: commandes, analyse des délais, contrôle des factures et marchandises reçues, en attentes, ...</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="P21">Marketing: gestion des campagnes marketing</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">Réseaux: gestion de parcs informatiques installés chez les clients</para>
- <para style="P21">Les aspects suivants ne sont pas encore repris dans le logiciel et seront développé:</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">La production: OF, nomenclatures flexibles, différentes appellation d'un même produit (client, fournisseur, ...), prix de revient.</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P21">Les petites adaptations pour l'activité logicielle de EMKA.</para>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P25">Les développements spécifiques:</para>
- <para style="P27">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="454.0" style="Tableau7">
- <tr>
- [[ repeatIn(o.paragraph_ids, 'x') ]]
- <td>
- <para style="P14">[[ x.type_id and x.type_id.name=='specific' and x.content or removeParentNode('tr') ]]</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="P21">
- <font color="white"> </font>
- </para>
- <para style="P25">Seront fournis</para>
- <para style="P28">
- <font color="white"> </font>
- </para>
- <para style="P29">Matériel: Boite Tiny ERP: CD, Licence, Documentation</para>
- <para style="P29">Accès aux resources: manuels techniques, faqs, hotline, documentation pro-active, ...</para>
- <para style="P29">
- <font color="white"> </font>
- </para>
- <para style="P25">Licence libre</para>
- <para style="P25">
- <font color="white"> </font>
- </para>
- <para style="P30">Le logiciel et les développements apportés seront sous licence GPL. Cela vous garanti:</para>
- <para style="P31">
- <font color="white"> </font>
- </para>
- <para style="P32" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">De n'avoir aucune licence annuelle ou mensuelle à payer,</para>
- <para style="P32" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">De bénéficier gratuitement des améliorations et nouvelles versions,</para>
- <para style="P32" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">De pouvoir le dupliquer pour vos filiales ou nouveaux postes clients,</para>
- <para style="P32" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">De pouvoir maîtriser le produit en interne pour vos besoins très spécifiques. (sources disponibles)</para>
- <para style="P32" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Notre licence est la GPL Version 2; http://www.gnu.org/licenses/gpl.html</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="P17">Les délais:</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <para style="P27">Voir planing en pièce jointe.</para>
- <para style="P31">
- <font color="white"> </font>
- </para>
- <para style="P17">Budget:</para>
- <para style="Text body">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="454.0" style="Tableau8">
- <tr>
- [[ repeatIn(o.paragraph_ids, 'x') ]]
- <td>
- <para style="P14">[[ x.type_id and x.type_id.name=='price' and x.content or removeParentNode('tr') ]]</para>
- <para style="P14">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="P33">
- <font color="white"> </font>
- </para>
- <para style="P9">Tarif pour:</para>
- <para style="P12" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'étude approfondie de vos besoins</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'adaptation de Tiny ERP aux besoins (développements)</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Le paramétrage du logiciel et la récupération des données clients</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">L'intégration/l'installation sur site</para>
- <para style="P13" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Le matériel du serveur</para>
- <para style="P34" leftIndent="15" bulletIndent="0" bulletFontSize="7" bulletFontName="ZapfDingbats" bulletText="l">Les formations de un ou deux utilisateurs clés</para>
- <para style="P35">Montant: </para>
- <para style="P36">
- <font color="white"> </font>
- </para>
- <para style="P36">
- <font color="white"> </font>
- </para>
- <para style="P25">Conditions</para>
- <para style="P27">
- <font color="white"> </font>
- </para>
- <para style="P27">Conditions générales de ventes disponibles au verso du présent document et/ou sur notre site Internet: http://tiny.be</para>
- <para style="P27">Validité de l'offre: 1 mois.</para>
- <para style="P27">Les montant ci-dessus s'entendent hors TVA.</para>
- <para style="P27">Paiement: 35% à la commande, 35% à l'installation, 30% 1 mois après l'installation.</para>
- </story>
-</document>
-
diff --git a/addons/letter/report/letter.xml b/addons/letter/report/letter.xml
deleted file mode 100644
index 8d3f7fd0286..00000000000
--- a/addons/letter/report/letter.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<letter>
- <paragraphes>
- <paragraphe type="zoom" name="paragraph_ids">
- <content type="field" name="content"/>
- </paragraphe>
- </paragraphes>
-</letter>
diff --git a/addons/letter/report/letter.xsl b/addons/letter/report/letter.xsl
deleted file mode 100644
index c1589961b21..00000000000
--- a/addons/letter/report/letter.xsl
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:import href="custom_default.xsl"/>
- <xsl:import href="custom_rml.xsl"/>
-
- <xsl:template match="/">
- <xsl:call-template name="rml"/>
- </xsl:template>
-
- <xsl:template name="stylesheet">
- </xsl:template>
-
- <xsl:template name="story">
- <xsl:apply-templates select="letter"/>
- </xsl:template>
-
- <xsl:template match="letter">
- <xsl:apply-templates select="paragraphes"/>
- </xsl:template>
-
- <xsl:template match="paragraphes">
- <xsl:apply-templates select="paragraphe"/>
- </xsl:template>
-
- <xsl:template match="paragraphe">
- <xsl:value-of select="." disable-output-escaping="yes"/>
- <spacer width="4mm" length="4mm"/>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/addons/letter/wizard/__init__.py b/addons/letter/wizard/__init__.py
deleted file mode 100644
index 92732ec0152..00000000000
--- a/addons/letter/wizard/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be)
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contact a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_paragraph_load
diff --git a/addons/letter/wizard/wizard_paragraph_load.py b/addons/letter/wizard/wizard_paragraph_load.py
deleted file mode 100644
index 0daecba5393..00000000000
--- a/addons/letter/wizard/wizard_paragraph_load.py
+++ /dev/null
@@ -1,71 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import netsvc
-
-_line_form = '''<?xml version="1.0"?>
-<form string="Letter Paragraphs">
- <separator string="Choose Paragraphs to add" colspan="4"/>
- <field name="paragraph_lines" colspan="4" nolabel="1"/>
-</form>'''
-
-_line_fields = {
- 'paragraph_lines': {'string':'Paragraphs', 'type':'many2many', 'relation':'letter.paragraph'},
-}
-
-def _paragraph_find(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- type_id = service.execute(cr.dbname, uid, 'letter.letter', 'read', [data['id']], ['type_id'])[0]['type_id'][0]
- para_ids = service.execute(cr.dbname, uid, 'letter.letter.type', 'read', [type_id], ['paragraph_ids'])[0]['paragraph_ids']
- return {'paragraph_lines': para_ids}
-
-def _paragraph_add(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- lines = service.execute(cr.dbname, uid, 'letter.paragraph', 'read', data['form']['paragraph_lines'][0][2], ['name','sequence','content','type_id'])
- adding = []
- for line in lines:
- line['letter_id'] = data['id']
- line['type_id'] = line['type_id'][0]
- del line['id']
- adding.append((0,0,line))
- service.execute(cr.dbname, uid, 'letter.letter', 'write', [data['id']], {'paragraph_ids': adding})
- return {}
-
-class paragraph_load(wizard.interface):
- states = {
- 'init': {
- 'actions': [_paragraph_find],
- 'result': {'type':'form', 'arch':_line_form, 'fields':_line_fields, 'state':[('end','Cancel'),('add','Add Paragraphs')]}
- },
- 'add': {
- 'actions': [_paragraph_add],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-paragraph_load('letter.paragraph.load')
-
diff --git a/addons/marketing/__init__.py b/addons/marketing/__init__.py
deleted file mode 100644
index fff87993f74..00000000000
--- a/addons/marketing/__init__.py
+++ /dev/null
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-"""
-Manage marketing campaign in Tiny ERP.
-
-You can Define campaigns: a list of step.
-
-Multiple commercials can use the campaigns.
-"""
-
-__author__ = "Fabien Pinckaers"
-__date__ = "28/02/2005"
-__version__ = 0.8
-
-import campaign
-
diff --git a/addons/marketing/__terp__.py b/addons/marketing/__terp__.py
deleted file mode 100644
index ab09cac9adc..00000000000
--- a/addons/marketing/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "Marketing Campaigns",
- "version" : "1.0",
- "author" : "Tiny",
- "website" : "http://tinyerp.com/module_crm_marketing.html",
- "category" : "Generic Modules/Others",
- "depends" : ["base"],
- "description": "Marketing management module",
- "init_xml" : [],
- "demo_xml" : ["campaign/campaign_demo.xml"],
- "update_xml" : ["campaign/campaign_view.xml", "campaign/campaign_wizard.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/marketing/campaign/__init__.py b/addons/marketing/campaign/__init__.py
deleted file mode 100644
index 1cd84c53edc..00000000000
--- a/addons/marketing/campaign/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import campaign
-import wizard
diff --git a/addons/marketing/campaign/campaign.py b/addons/marketing/campaign/campaign.py
deleted file mode 100644
index 4a578124d01..00000000000
--- a/addons/marketing/campaign/campaign.py
+++ /dev/null
@@ -1,166 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv, orm
-import time
-import tools
-
-class campaign_campaign(osv.osv):
- _name = "campaign.campaign"
- _columns = {
- 'name': fields.char('Name', size=60, required=True),
- 'info': fields.text('Description'),
- 'costs': fields.float('Initial Costs'),
- 'date_start': fields.date('Start Date'),
- 'date_stop': fields.date('Stop Date'),
- 'planned_costs': fields.float('Planned Costs'),
- 'planned_revenue': fields.float('Planned Revenue'),
- 'step_id': fields.one2many('campaign.step','campaign_id', 'Campaign Steps')
- }
-campaign_campaign()
-
-class campaign_steps(osv.osv):
- _name = "campaign.step"
- _columns = {
- 'name': fields.char('Step Name', size=60, required=True),
-#TODO: use sequence instead of priority
- 'priority': fields.integer('Sequence', required=True),
- 'info': fields.text('Description'),
- 'procent': fields.float('Success Rate (0<x<1)'),
- 'costs': fields.float('Step Costs'),
- 'active': fields.boolean('Active'),
- 'start_date': fields.date('Start Date'),
- 'stop_date': fields.date('Stop Date'),
- 'max_try': fields.integer('Max Attemps'),
- 'campaign_id': fields.many2one('campaign.campaign', 'Campaign')
- }
- _defaults = {
- 'active':lambda *a: 1,
- 'max_try':lambda *a: 1
- }
- _order = 'priority'
-campaign_steps()
-
-class campaign_partner(osv.osv):
- _name = "campaign.partner"
- _columns = {
- 'name': fields.char('Name / Reference', size=64, required=True),
- 'user_id': fields.many2one('res.users', 'Salesman'),
- 'step': fields.many2one('campaign.step', 'Step', required=True, states={'wait':[('readonly',True)],'stop':[('readonly',True)]}),
- 'priority': fields.selection([('0','Very Low'),('1','Low'),('2','Medium'),('3','High'),('4','Very High')], 'Priority', required=True, states={'wait':[('readonly',True)],'stop':[('readonly',True)]}),
- 'partner_id': fields.many2one('res.partner', 'Partner', required=True),
- 'part_adr_id': fields.many2one('res.partner.address', 'Partner Address', required=True),
- 'contact': fields.char('Partner Contact', size=64),
- 'notes': fields.text('Prospect Notes'),
-
- 'date_recall': fields.datetime('Call again on', states={'wait':[('readonly',True)],'stop':[('readonly',True)]}),
- 'info': fields.text('Comments', states={'wait':[('readonly',True)],'stop':[('readonly',True)]}),
- 'active': fields.boolean('Active'),
- 'history_ids': fields.one2many('campaign.partner.history', 'camp_partner_id', 'History'),
- 'campaign_id': fields.many2one('campaign.campaign', 'Campaign'),
- 'state': fields.selection([('draft','Normal'), ('wait','Waiting'), ('stop','Stopped')], 'State', readonly=True)
- }
- _defaults = {
- 'state': lambda *a: 'draft',
- 'active': lambda *a: 1
- }
- _order = 'state,priority desc,name'
-
- def recall(self,cr, uid, ids, *args):
- res = self.read(cr,uid,ids,['date_recall', 'name', 'info', 'step'])
- for r in res:
- if not r['date_recall']:
- raise orm.except_orm('ValidateError', ('Error, choose a date', 'date_recall'))
-
- for r in res:
- self.pool.get('campaign.partner.history').create(cr, uid, {
- 'name': 'Recall Later ' + str(r['date_recall']),
- 'info': r['info'],
- 'date': time.strftime('%Y-%m-%d %H:%M:%S'),
- 'step_id': r['step'][0],
- 'camp_partner_id': r['id']
- })
- self.pool.get('ir.cron').create(cr, uid, {
- 'user_id': uid,
- 'name': 'Campaign: Recall',
- 'nextcall': r['date_recall'],
- 'active': True,
- 'numbercall': 1,
- 'model': self._name,
- 'function': 'write',
- 'args': repr([[r['id']], {'date_recall':False, 'state':'draft'}])
- })
- self.write(cr, uid, ids, {'state':'wait'})
- return True
-
- def stop_camp(self,cr, uid, ids, *args):
- self.write(cr, uid, ids, {'state':'stop', 'active':0})
- return True
-
- def continue_camp(self, cr, uid, ids, *args):
- res = self.read(cr, uid, ids, ['info', 'state', 'step', 'campaign_id'])
- for r in res:
- self.pool.get('campaign.partner.history').create(cr, uid, {
- 'name': r['step'][1],
- 'info': r['info'],
- 'date': time.strftime('%Y-%m-%d %H:%M:%S'),
- 'step_id': r['step'][0],
- 'camp_partner_id': r['id']
- })
- cr.execute('select id,start_date from campaign_step where priority>(select priority from campaign_step where id=%d) and campaign_id=%d order by priority limit 1', (r['step'][0],r['campaign_id'][0]))
- nextstep = cr.fetchone()
- if nextstep:
- dt = False
- if nextstep[1] > time.strftime('%Y-%m-%d'):
- dt = nextstep[1]
- self.write(cr, uid, [r['id']], {
- 'step': nextstep[0],
- 'state': 'draft',
- 'info': '',
- 'date_recall': dt,
- 'active': True
- })
- if dt:
- self.recall(cr, uid, [r['id']])
- return True
-campaign_partner()
-
-class campaign_partner_history(osv.osv):
- _name = "campaign.partner.history"
- _columns = {
- 'name': fields.char('History', size=64, required=True),
- 'info': fields.text('Comments'),
- 'date': fields.datetime('Date', readonly=True),
- 'step_attempt': fields.integer('Attempt', readonly=True),
- 'step_id': fields.many2one('campaign.step', 'Step', readonly=True),
- 'camp_partner_id': fields.many2one('campaign.partner', 'Prospect', readonly=True),
- }
-campaign_partner_history()
-
diff --git a/addons/marketing/campaign/campaign_demo.xml b/addons/marketing/campaign/campaign_demo.xml
deleted file mode 100644
index 34c9788959c..00000000000
--- a/addons/marketing/campaign/campaign_demo.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
- <record model="campaign.campaign" id="campaign">
- <field name="name">Marketing Campaign: Solutions Linux 2005</field>
- <field name="info">Marketing Campaign for meeting Solutions Linux 2005.</field>
- <field name="costs">500</field>
- <field name="planned_costs">2500</field>
- <field name="planned_revenue">15000</field>
- </record>
- <record model="campaign.step">
- <field name="campaign_id" eval="campaign"/>
- <field name="name">First Contact, letters</field>
- <field name="priority">1</field>
- <field name="procent" eval="0.1"/>
- <field name="costs" eval="0.5"/>
- </record>
- <record model="campaign.step">
- <field name="campaign_id" eval="campaign"/>
- <field name="name">Confirmation by E-Mail</field>
- <field name="priority">2</field>
- <field name="procent" eval="0.15"/>
- <field name="costs" eval="0.1"/>
- </record>
- <record model="campaign.step">
- <field name="campaign_id" eval="campaign"/>
- <field name="name">Plan a meeting, phone calls, send folders</field>
- <field name="priority">3</field>
- <field name="procent" eval="0.2"/>
- <field name="costs" eval="1.5"/>
- </record>
-</data>
-</terp>
diff --git a/addons/marketing/campaign/campaign_view.xml b/addons/marketing/campaign/campaign_view.xml
deleted file mode 100644
index abf004a8c31..00000000000
--- a/addons/marketing/campaign/campaign_view.xml
+++ /dev/null
@@ -1,189 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
- <menuitem name="Marketing Operations" groups="admin" icon="terp-marketing" id="menu_marketing_operations"/>
-
- <record model="ir.ui.view" id="campaign_campaign_tree">
- <field name="model">campaign.campaign</field>
- <field name="name">campaign.campaign.view</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Campaigns">
- <field name="date_start"/>
- <field name="date_stop"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="campaign_campaign_form">
- <field name="model">campaign.campaign</field>
- <field name="name">campaign.campaign.view</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Campaign Definition">
- <field name="name" colspan="4" select="1"/>
- <field name="costs"/>
- <newline/>
- <field name="date_start"/>
- <field name="date_stop"/>
- <field name="planned_costs"/>
- <field name="planned_revenue"/>
- <field name="info" colspan="4"/>
- <field name="step_id" colspan="4" widget="one2many_list"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="view_campaign_tree">
- <field name="res_model">campaign.campaign</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">tree</field>
- <field name="view_id" ref="campaign_campaign_tree"/>
- </record>
- <menuitem name="Marketing Operations/Campaigns" action="view_campaign_tree" groups="admin" id="menu_marketing_operations_campaigns"/>
-
- <record model="ir.actions.act_window" id="view_campaign_form">
- <field name="res_model">campaign.campaign</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Marketing Operations/Configuration" groups="admin" sequence="1" id="menu_op_config"/>
- <menuitem name="Marketing Operations/Configuration/Campaign Definition" action="view_campaign_form" id="menu_op_config_camp_def"/>
-
- <record model="ir.ui.view" id="view_campaign_step_tree">
- <field name="model">campaign.step</field>
- <field name="name">campaign.step.tree</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Campaign Steps">
- <field name="priority" select="1"/>
- <field name="name"/>
- <field name="start_date"/>
- <field name="stop_date"/>
- <field name="procent"/>
- <field name="costs"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_campaign_step_form">
- <field name="model">campaign.step</field>
- <field name="name">campaign.step.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Marketing Steps">
- <field name="name" select="1" colspan="4"/>
- <field name="priority" select="1"/>
- <field name="active" select="1"/>
- <field name="start_date" select="1"/>
- <field name="stop_date"/>
- <field name="procent"/>
- <field name="costs"/>
- <field name="max_try"/>
- <newline/>
- <field name="info" colspan="4"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="campaign_partner_tree">
- <field name="model">campaign.partner</field>
- <field name="name">campaign.partner.tree</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Marketing Prospects">
- <field name="partner_id" colspan="4"/>
- <field name="contact"/>
- <field name="step" select="1"/>
- <field name="user_id" select="1"/>
- <field name="priority" select="1"/>
- <field name="state" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="campaign_partner_form">
- <field name="model">campaign.partner</field>
- <field name="name">campaign.partner.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Marketing::Prospects">
- <notebook>
- <page string="Main Information">
- <separator string="Prospect Information" colspan="4"/>
- <field name="name" select="1" colspan="4"/>
- <field name="user_id" select="1"/>
- <field name="active" select="1"/>
- <field name="partner_id" select="1"/>
- <field name="campaign_id"/>
- <field name="part_adr_id"/>
- <field name="contact"/>
- <field name="notes" colspan="4"/>
- <separator string="Step Information" colspan="4"/>
- <field name="step" select="1" domain="[('campaign_id','=',campaign_id)]"/>
- <field name="priority" select="1"/>
- <field name="date_recall" colspan="2"/>
- <button name="recall" type="object" string="Call again Later" states="draft"/>
- <newline/>
- <field name="info" colspan="4"/>
- <field name="state" select="1"/>
- <group col="2" colspan="2">
- <button name="stop_camp" type="object" string="Stop Campaign" states="draft,wait"/>
- <button name="continue_camp" type="object" string="Continue Campaign" states="stop,draft,wait"/>
- </group>
- </page><page string="History">
- <field name="history_ids" colspan="4" nolabel="1" readonly="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_campaign_partner_history_form">
- <field name="model">campaign.partner.history</field>
- <field name="name">campaign.partner.history.form</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="History">
-<!--
- <field name="name" colspan="4"/>
--->
- <field name="step_id"/>
- <field name="date"/>
- <separator string="Comments" colspan="4"/>
- <field name="info" colspan="4" nolabel="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_campaign_partner_history">
- <field name="model">campaign.partner.history</field>
- <field name="name">campaign.partner.history.tree</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="History">
- <field name="step_id"/>
- <field name="date"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_campaign_open">
- <field name="res_model">campaign.partner</field>
- <field name="type">ir.actions.act_window</field>
- <field name="domain">[('campaign_id','=',active_id)]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
-
- <record model="ir.values" id="ir_campaign_open">
- <field name="key" eval="'action'"/>
- <field name="key2" eval="'tree_but_open'"/>
- <field name="model" eval="'campaign.campaign'"/>
- <field name="name">Open Campaign</field>
- <field name="value" eval="'ir.actions.act_window,%d'%action_campaign_open"/>
- <field name="object" eval="True"/>
- </record>
-
-</data>
-</terp>
diff --git a/addons/marketing/campaign/campaign_wizard.xml b/addons/marketing/campaign/campaign_wizard.xml
deleted file mode 100644
index d5dcf987a10..00000000000
--- a/addons/marketing/campaign/campaign_wizard.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <wizard id="wizard_load_partners" string="Load partners" model="campaign.campaign" name="campaign.partner.add" keyword="tree_but_action"/>
- <wizard id="wizard_email" string="Send an email" model="campaign.partner" name="campaign.partner.email_send"/>
-<!--
- <wizard id="wizard_sms" string="Send a SMS" model="campaign.partner" name="campaign.partner.sms_send"/>
--->
- </data>
-</terp>
diff --git a/addons/marketing/campaign/wizard/__init__.py b/addons/marketing/campaign/wizard/__init__.py
deleted file mode 100644
index 43af56aa774..00000000000
--- a/addons/marketing/campaign/wizard/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_campaign_email
-import wizard_campaign_partner_add
diff --git a/addons/marketing/campaign/wizard/wizard_campaign_email.py b/addons/marketing/campaign/wizard/wizard_campaign_email.py
deleted file mode 100644
index 8143e736350..00000000000
--- a/addons/marketing/campaign/wizard/wizard_campaign_email.py
+++ /dev/null
@@ -1,71 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import netsvc
-
-email_send_form = '''<?xml version="1.0"?>
-<form string="Send an E-Mail">
- <separator string="Header" colspan="4"/>
- <field name="from"/>
- <field name="on_error"/>
- <newline/>
- <field name="subject" colspan="3"/>
- <newline/>
- <separator string="Email" colspan="4"/>
- <field name="body" colspan="3"/>
-</form>'''
-
-email_send_fields = {
- 'from': {'string':'From', 'type':'char', 'required':True},
- 'on_error': {'string':'Error Return To', 'type':'char', 'required':True},
- 'subject': {'string':'Subject', 'type':'char', 'required':True},
- 'body': {'string':'Email Message', 'type':'text', 'required':True}
-}
-
-def _email_send(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- res = service.execute(cr.dbname, uid, 'campaign.partner', 'read', data['ids'], ['partner_id'])
- partners_id = map(lambda r: r['partner_id'][0], res)
- form = data['form']
- nbr = service.execute(cr.dbname, uid, 'res.partner', 'email_send', partners_id, form['from'], form['subject'], form['body'], form['on_error'])
- return {'email_sent': nbr}
-
-class part_email(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':email_send_form, 'fields':email_send_fields, 'state':[('end','Cancel'),('send','Send Email')]}
- },
- 'send': {
- 'actions': [_email_send],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-part_email('campaign.partner.email_send')
-
-
diff --git a/addons/marketing/campaign/wizard/wizard_campaign_partner_add.py b/addons/marketing/campaign/wizard/wizard_campaign_partner_add.py
deleted file mode 100644
index b26e08aecc7..00000000000
--- a/addons/marketing/campaign/wizard/wizard_campaign_partner_add.py
+++ /dev/null
@@ -1,79 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-campaign_form = '''<?xml version="1.0"?>
-<form string="Add partners to campaign">
- <separator string="Default Values" colspan="4"/>
- <field name="campaign_step_id"/>
- <field name="priority"/>
- <field name="user_id"/>
- <newline/>
- <separator string="Partners" colspan="4"/>
- <field name="partners" nolabel="1" colspan="4"/>
-</form>'''
-
-campaign_fields = {
- 'campaign_step_id': {'string':'First Campaign Step', 'type':'many2one', 'relation':'campaign.step', 'required':True},
- 'priority': {'selection':[('0','Very Low'),('1','Low'),('2','Medium'),('3','Good'),('4','Very Good')], 'string':'Priority', 'type':'selection', 'required':True},
- 'user_id': {'string':'User', 'type':'many2one', 'relation':'res.users'},
- 'partners': {'string':'Partners', 'type':'many2many', 'required':True, 'relation':'res.partner'}
-}
-
-def _partner_add(self, cr, uid, data, context):
- partners = pooler.get_pool(cr.dbname).get('res.partner').browse(cr, uid, data['form']['partners'][0][2])
- campaign_partner_obj = pooler.get_pool(cr.dbname).get('campaign.partner')
- for partner in partners:
- if partner.address:
- campaign_partner_obj.create(cr, uid, {
- 'name': partner.name,
- 'user_id': data['form']['user_id'],
- 'step': data['form']['campaign_step_id'],
- 'priority': data['form']['priority'],
- 'partner_id': partner.id,
- 'part_adr_id': partner.address and partner.address[0].id or False,
- 'contact': partner.address and partner.address[0].phone or False,
- 'campaign_id': data['id']
- })
- return {}
-
-class part_add(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':campaign_form, 'fields':campaign_fields, 'state':[('end','Cancel'), ('add','Add these partners')]}
- },
- 'add': {
- 'actions': [_partner_add],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-part_add('campaign.partner.add')
-
diff --git a/addons/multi_company_hr_timesheet_sheet/__init__.py b/addons/multi_company_hr_timesheet_sheet/__init__.py
deleted file mode 100644
index 5ac72900e94..00000000000
--- a/addons/multi_company_hr_timesheet_sheet/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import multi_company_hr_timesheet_sheet
diff --git a/addons/multi_company_hr_timesheet_sheet/__terp__.py b/addons/multi_company_hr_timesheet_sheet/__terp__.py
deleted file mode 100644
index a70526e434c..00000000000
--- a/addons/multi_company_hr_timesheet_sheet/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Multi company Human Resources (Timesheet groups)",
- "version" : "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Human Resources",
- "depends" : ["hr_timesheet_sheet","base", 'multi_company',],
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["multi_company_hr_timesheet_sheet_view.xml","multi_company_hr_timesheet_sheet_data.xml",],
- "active": False,
- "installable": True
-}
diff --git a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet.py b/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet.py
deleted file mode 100644
index 49560c19950..00000000000
--- a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet.py
+++ /dev/null
@@ -1,40 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product_extended.py 5702 2007-02-20 15:33:28Z ced $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class hr_timesheet_sheet(osv.osv):
- _inherit = 'hr_timesheet_sheet.sheet'
- _columns = {
- 'company_id': fields.many2one('res.company', 'Company'),
- }
- _defaults = {
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
- }
-hr_timesheet_sheet()
diff --git a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_data.xml b/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_data.xml
deleted file mode 100644
index e81dfb08aaf..00000000000
--- a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <record model="ir.rule.group" id="timesheet_comp_rule_group">
- <field name="name">Timesheet multi-company</field>
- <field name="model_id" search="[('model','=','hr_timesheet_sheet.sheet')]" model="ir.model"/>
- <field name="global" eval="True"/>
- </record>
- <record model="ir.rule" id="timesheet_comp_rule">
- <field name="field_id" search="[('model','=','hr_timesheet_sheet.sheet'),('name','=','company_id')]" model="ir.model.fields"/>
- <field name="operator">child_of</field>
- <field name="operand">user.company_id.id</field>
- <field name="rule_group" ref="timesheet_comp_rule_group"/>
- </record>
-
- </data>
-</terp>
diff --git a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_view.xml b/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_view.xml
deleted file mode 100644
index a89957db10f..00000000000
--- a/addons/multi_company_hr_timesheet_sheet/multi_company_hr_timesheet_sheet_view.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <record model="ir.ui.view" id="hr_timesheet_sheet_form">
- <field name="name">hr.timesheet.sheet.form.multicompany</field>
- <field name="model">hr_timesheet_sheet.sheet</field>
- <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
- <field name="arch" type="xml">
- <field name="date_to" position="after">
- <field name="company_id" select="1"/>
- </field>
- </field>
- </record>
-
- </data>
-</terp>
diff --git a/addons/multi_company_project/__init__.py b/addons/multi_company_project/__init__.py
deleted file mode 100644
index a355a1361f3..00000000000
--- a/addons/multi_company_project/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import multi_company_project
diff --git a/addons/multi_company_project/__terp__.py b/addons/multi_company_project/__terp__.py
deleted file mode 100644
index f77c47256a6..00000000000
--- a/addons/multi_company_project/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Multi company Project Management",
- "version": "0.1",
- "author" : "Tiny",
- "category" : "Generic Modules/Projects & Services",
- "depends" : ['project', 'base', 'multi_company',],
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml": ['multi_company_project_view.xml','multi_company_project_data.xml',],
- "active": False,
- "installable": True
-}
diff --git a/addons/multi_company_project/multi_company_project.py b/addons/multi_company_project/multi_company_project.py
deleted file mode 100644
index c92fedc021d..00000000000
--- a/addons/multi_company_project/multi_company_project.py
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product_extended.py 5702 2007-02-20 15:33:28Z ced $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class project(osv.osv):
- _inherit = 'project.project'
- _columns = {
- 'company_id': fields.many2one('res.company', 'Company'),
- }
- _defaults = {
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
- }
-project()
-
-class project_task(osv.osv):
- _inherit = 'project.task'
- _columns = {
- 'company_id': fields.many2one('res.company', 'Company'),
- }
- _defaults = {
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
- }
-project_task()
diff --git a/addons/multi_company_project/multi_company_project_data.xml b/addons/multi_company_project/multi_company_project_data.xml
deleted file mode 100644
index df5a0d194d0..00000000000
--- a/addons/multi_company_project/multi_company_project_data.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <record model="ir.rule.group" id="project_comp_rule_group">
- <field name="name">Project multi-company</field>
- <field name="model_id" search="[('model','=','project.project')]" model="ir.model"/>
- <field name="global" eval="True"/>
- </record>
- <record model="ir.rule" id="project_comp_rule">
- <field name="field_id" search="[('model','=','project.project'),('name','=','company_id')]" model="ir.model.fields"/>
- <field name="operator">child_of</field>
- <field name="operand">user.company_id.id</field>
- <field name="rule_group" ref="project_comp_rule_group"/>
- </record>
-
- <record model="ir.rule.group" id="task_comp_rule_group">
- <field name="name" >Task multi-company</field>
- <field name="model_id" search="[('model','=','project.task')]" model="ir.model"/>
- <field name="global" eval="True"/>
- </record>
- <record model="ir.rule" id="task_comp_rule">
- <field name="field_id" search="[('model','=','project.task'),('name','=','company_id')]" model="ir.model.fields"/>
- <field name="operator">child_of</field>
- <field name="operand">user.company_id.id</field>
- <field name="rule_group" ref="task_comp_rule_group"/>
- </record>
-
- </data>
-</terp>
diff --git a/addons/multi_company_project/multi_company_project_view.xml b/addons/multi_company_project/multi_company_project_view.xml
deleted file mode 100644
index ebceaf3f576..00000000000
--- a/addons/multi_company_project/multi_company_project_view.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
-
- <record model="ir.ui.view" id="edit_project_multicompany">
- <field name="name">project.project.form.multicompany</field>
- <field name="model">project.project</field>
- <field name="inherit_id" ref="project.edit_project"/>
- <field name="arch" type="xml">
- <field name="warn_manager" position="after">
- <field name="company_id" select="1"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_task_form2_multicompany">
- <field name="name">project.task.form.multicompany</field>
- <field name="model">project.task</field>
- <field name="inherit_id" ref="project.view_task_form2"/>
- <field name="arch" type="xml">
- <field name="type" position="after">
- <field name="company_id" select="1"/>
- </field>
- </field>
- </record>
-
-
- </data>
-</terp>
diff --git a/addons/network/__init__.py b/addons/network/__init__.py
deleted file mode 100644
index e82a44ff55b..00000000000
--- a/addons/network/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import network
diff --git a/addons/network/__terp__.py b/addons/network/__terp__.py
deleted file mode 100644
index 13552ed074d..00000000000
--- a/addons/network/__terp__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name" : "Network Management",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Enterprise Specific Modules/Information Technology",
- "depends" : ["base"],
- "init_xml" : [],
- "description": """
- A simple module to encode your networks and materials:
- - networks and connections between networks
- - hardwares and softwares with:
- - versions, access rights, waranties
-
- You can print interventions form for technical people.""",
- "demo_xml" : ["network_demo.xml"],
- "update_xml" : ["network_view.xml", "network_report.xml"],
- "active" : False,
- "installable": True
-}
diff --git a/addons/network/network.py b/addons/network/network.py
deleted file mode 100644
index 1c7e9268483..00000000000
--- a/addons/network/network.py
+++ /dev/null
@@ -1,164 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-from osv import fields, osv
-
-#---------------------------------------------------------
-# Type of hardware: Printers, Screens, HD, ....
-#---------------------------------------------------------
-class network_hardware_type(osv.osv):
- _name = "network.hardware.type"
- _description = "Hardware type"
- _columns = {
- 'name': fields.char('Type of material', size=64, required=True),
- 'networkable': fields.boolean('Networkable hardware'),
- }
- _defaults = {
- 'networkable': lambda *a: False,
- }
-network_hardware_type()
-
-#--------------------------------------------------------------
-# A network is composed of all kind of networkable materials
-#--------------------------------------------------------------
-class network_network(osv.osv):
- _name = 'network.network'
- _description = 'Network'
- _columns = {
- 'name': fields.char('Network name', size=64, required=True),
- 'range': fields.char('Address range', size=128),
- 'user_id': fields.many2one('res.users','Onsite Contact person'),
- 'contact_id': fields.many2one('res.partner', 'Partner', required=True),
- 'material_ids': fields.one2many('network.material', 'network_id', 'Members'),
- }
-network_network()
-
-def _calc_warranty(*args):
- now = list(time.localtime())
- now[0] += 1
- return time.strftime('%Y-%m-%d', tuple(now))
-
-#----------------------------------------------------------
-# Materials; computer, printer, switch, ...
-#----------------------------------------------------------
-class network_material(osv.osv):
- _name = "network.material"
- _description = "Material"
- _columns = {
- 'name': fields.char('Device Name', size=64, required=True),
- 'ip_addr': fields.char('IP Address', size=16),
- 'network_id': fields.many2one('network.network', 'Network'),
- 'supplier': fields.many2one('res.partner', 'Supplier'),
- 'date': fields.date('Installation Date'),
- 'warranty': fields.date('Warranty deadline'),
- 'type': fields.many2one('network.hardware.type',
- 'Hardware type', required=True),
- 'note': fields.text('Notes'),
- 'parent_id': fields.many2one('network.material',
- 'Parent Material'),
- 'child_id': fields.one2many('network.material', 'parent_id',
- 'Childs Materials'),
- 'software_id': fields.one2many('network.software',
- 'material_id',
- 'Installed Software'),
- 'change_id': fields.one2many('network.changes',
- 'machine_id',
- 'Changes on this machine'),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- 'warranty': _calc_warranty,
- }
-network_material()
-
-#----------------------------------------------------------
-# Changes on this machine
-#----------------------------------------------------------
-class network_changes(osv.osv):
- _name = 'network.changes'
- _description = 'Network changes'
- _columns = {
- 'name': fields.char('Short Description', size=64,
- required=True),
- 'description': fields.text('Long Description'),
- 'date': fields.date('Change date'),
- 'machine_id': fields.many2one('network.material',
- 'Machine'),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- }
-network_changes()
-
-#----------------------------------------------------------
-# Type of Software; LDAP, Tiny ERP, Postfix
-#----------------------------------------------------------
-class network_soft_type(osv.osv):
- _name = "network.software.type"
- _description = "Software type"
- _columns = {
- 'name': fields.char('Composant Name', size=64, required=True),
- 'note': fields.text('Notes'),
- }
-network_soft_type()
-
-#----------------------------------------------------------
-# A software installed on a material
-#----------------------------------------------------------
-class network_software(osv.osv):
- _name = "network.software"
- _description = "Software"
- _columns = {
- 'name': fields.char('Composant Name', size=64, required=True),
- 'material_id': fields.many2one('network.material', 'Material'),
- 'type': fields.many2one('network.software.type',
- 'Software Type', required=True),
- 'version': fields.char('Software version', size=32),
- 'logpass': fields.one2many('network.software.logpass',
- 'software_id', 'Login / Password'),
- 'email': fields.char('Contact Email', size=32),
- 'date': fields.date('Installation Date', size=32),
- 'note': fields.text('Notes'),
- }
-network_software()
-
-#------------------------------------------------------------
-# Couples of login/password
-#------------------------------------------------------------
-class network_software_logpass(osv.osv):
- _name = "network.software.logpass"
- _description = "Software login"
- _rec_name = 'login'
- _columns = {
- 'login': fields.char('Login', size=64, required=True),
- 'password': fields.char('Password', size=64, required=True),
- 'software_id': fields.many2one('network.software',
- 'Software', required=True),
- }
-network_software_logpass()
diff --git a/addons/network/network_demo.xml b/addons/network/network_demo.xml
deleted file mode 100644
index e091f5c82b7..00000000000
--- a/addons/network/network_demo.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data noupdate="1">
- <record model="network.hardware.type" id="demo_hard_type0">
- <field name="name">Computer</field>
- <field name="networkable">True</field>
- </record>
- <record model="network.hardware.type" id="demo_hard_type1">
- <field name="name">Hub</field>
- <field name="networkable">True</field>
- </record>
- <record model="network.hardware.type" id="demo_hard_type2">
- <field name="name">Switch</field>
- <field name="networkable">True</field>
- </record>
- <record model="network.hardware.type" id="demo_hard_type3">
- <field name="name">Screen</field>
- </record>
- <record model="network.hardware.type" id="demo_hard_type4">
- <field name="name">Network Printer</field>
- <field name="networkable">True</field>
- </record>
-
- <record model="network.network" id="net1">
- <field name="name">Production network</field>
- <field name="range">192.168.1.0/24</field>
- <field name="contact_id" search="[('name', 'ilike', 'Tiny')]"
- model="res.partner" />
- </record>
-
- <record model="network.material" id="pc1">
- <field name="name">PC1</field>
- <field name="type" ref="demo_hard_type0"/>
- <field name="network_id" ref="net1"/>
- </record>
- <record model="network.material" id="pc2">
- <field name="name">PC2</field>
- <field name="type" ref="demo_hard_type0"/>
- <field name="network_id" ref="net1"/>
- </record>
- <record model="network.material" id="pc3">
- <field name="name">PC3</field>
- <field name="type" ref="demo_hard_type0"/>
- <field name="network_id" ref="net1"/>
- </record>
-
- <record model="network.material" id="screen1">
- <field name="name">Eizo F56</field>
- <field name="type" ref="demo_hard_type3"/>
- <field name="parent_id" ref="pc1"/>
- </record>
- <record model="network.material" id="screen2">
- <field name="name">Acer 1617</field>
- <field name="type" ref="demo_hard_type3"/>
- <field name="parent_id" ref="pc2"/>
- </record>
- <record model="network.material" id="printer1">
- <field name="name">HP LaserJet 8150N Network Printer</field>
- <field name="type" ref="demo_hard_type4"/>
- <field name="network_id" ref="net1"/>
- </record>
-
- <record model="network.software.type" id="demo_soft_type0">
- <field name="name">LDAP</field>
- </record>
- <record model="network.software.type" id="demo_soft_type1">
- <field name="name">Database</field>
- </record>
- <record model="network.software.type" id="demo_soft_type2">
- <field name="name">DNS Server</field>
- </record>
-
- <record model="network.software" id="openldap">
- <field name="name">OpenLDAP</field>
- <field name="material_id" ref="pc1"/>
- <field name="version">2.2.23-1</field>
- <field name="type" ref="demo_soft_type0"/>
- </record>
- <record model="network.software" id="postgresql">
- <field name="name">PostGreSQL</field>
- <field name="material_id" ref="pc1"/>
- <field name="version">7.4.7-3</field>
- <field name="type" ref="demo_soft_type1"/>
- </record>
- <record model="network.software" id="bind">
- <field name="name">Bind</field>
- <field name="material_id" ref="pc2"/>
- <field name="version">1:9.2.4-1</field>
- <field name="type" ref="demo_soft_type2"/>
- </record>
-
- <record model="network.software.logpass">
- <field name="login">john</field>
- <field name="password">the-ripper</field>
- <field name="software_id" ref="openldap"/>
- </record>
- <record model="network.software.logpass">
- <field name="login">suzan</field>
- <field name="password">nazus</field>
- <field name="software_id" ref="openldap"/>
- </record>
- <record model="network.software.logpass">
- <field name="login">stevie</field>
- <field name="password">wonder</field>
- <field name="software_id" ref="postgresql"/>
- </record>
- </data>
-</terp>
diff --git a/addons/network/network_report.xml b/addons/network/network_report.xml
deleted file mode 100644
index ffa71a51fa5..00000000000
--- a/addons/network/network_report.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report string="Print Materials" model="network.material" name="network.material.list" xml="network/report/material.xml" xsl="network/report/material.xsl"/>
- <report string="Print Network Materials" model="network.network" name="network.network.list" xml="network/report/network.xml" xsl="network/report/network.xsl"/>
- <report string="Print Network List" model="network.network" name="network.network.list2" xml="network/report/network_list.xml" xsl="network/report/network_list.xsl"/>
- </data>
-</terp>
diff --git a/addons/network/network_view.xml b/addons/network/network_view.xml
deleted file mode 100644
index 2f74d6ada91..00000000000
--- a/addons/network/network_view.xml
+++ /dev/null
@@ -1,298 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
- <menuitem name="Tools/Network" groups="admin" id="menu_network"/>
- <menuitem name="Tools/Network/Configuration" id="menu_network_definition" groups="admin" sequence="1"/>
-
- <record model="ir.ui.view" id="edit_network">
- <field name="name">network.material.form</field>
- <field name="model">network.material</field>
- <field name="type">form</field>
- <field name="priority" eval="1"/>
- <field name="arch" type="xml">
- <form string="Network Material">
- <notebook>
- <page string="Material Info">
- <separator string="Informations" colspan="4"/>
- <field name="name" colspan="4" select="1"/>
- <field name="type" select="1"/>
- <field name="supplier" select="1" />
- <field name="date" select="1"/>
- <field name="warranty" />
- <field name="parent_id"/>
- <field name="network_id"/>
- <separator string="Softwares" colspan="4"/>
- <field name="software_id" nolabel="1" colspan="4" widget="one2many_list"/>
- </page>
- <page string="Updates">
- <field name="change_id" nolabel="1" colspan="4" widget="one2many_list" />
- </page>
- <page string="Notes">
- <field name="note" nolabel="1" colspan="4"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="material_view">
- <field name="name">network.material.tree</field>
- <field name="model">network.material</field>
- <field name="type">tree</field>
- <field name="field_parent">child_id</field>
- <field name="arch" type="xml">
- <tree string="All Network Material">
- <field name="name"/>
- <field name="type"/>
- <field name="supplier" />
- <field name="date"/>
- <field name="warranty" />
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_material_tree">
- <field name="res_model">network.material</field>
- <field name="view_type">form</field>
- <field name="domain">[('parent_id','=',False)]</field>
- </record>
- <menuitem name="Tools/Network/All Materials" id="menu_action_material_tree" action="action_material_tree" groups="admin"/>
-
- <record model="ir.ui.view" id="material_view_by_network">
- <field name="name">network.material.tree</field>
- <field name="model">network.material</field>
- <field name="type">tree</field>
- <field name="field_parent">child_id</field>
- <field name="arch" type="xml">
- <tree string="Material in this Network">
- <field name="name"/>
- <field name="date"/>
- <field name="type"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="tree_by_network">
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">network.material</field>
- <field name="view_type">tree</field>
- <field name="domain">[('network_id', '=', active_id)]</field>
- <field name="view_id" ref="material_view_by_network"/>
- </record>
- <record model="ir.values" id="ir_open_network">
- <field name="key" eval="'action'" />
- <field name="key2" eval="'tree_but_open'" />
- <field name="model" eval="'network.network'"/>
- <field name="name">Material</field>
- <field name="value" eval="'ir.actions.act_window,%d'%tree_by_network" />
- <field name="object" eval="True" />
- </record>
- <record model="ir.values" id="ir_open_network2">
- <field name="key" eval="'action'" />
- <field name="key2" eval="'client_action_multi'" />
- <field name="model" eval="'network.network'"/>
- <field name="name">Material</field>
- <field name="value"
- eval="'ir.actions.act_window,%d'%tree_by_network" />
- <field name="object" eval="True" />
- </record>
-
- <record model="ir.actions.act_window" id="edit_material_2click">
- <field name="view_mode">tree,form</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">network.material</field>
- <field name="view_type">form</field>
- <field name="domain">[('id', '=', active_id)]</field>
- <field name="view_id" ref="edit_network" />
- </record>
- <record model="ir.values" id="ir_open_network3">
- <field name="key" eval="'action'" />
- <field name="key2" eval="'tree_but_open'" />
- <field name="model" eval="'network.material'" />
- <field name="name">Material (edit)</field>
- <field name="value"
- eval="'ir.actions.act_window,%d'%edit_material_2click" />
- <field name="object" eval="True" />
- </record>
-
- <record model="ir.ui.view" id="view_software_type_form">
- <field name="name">network.software.type.form</field>
- <field name="model">network.software.type</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Software Type">
- <field name="name" colspan="4" select="1"/>
- <field name="note" colspan="4"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_software_type">
- <field name="res_model">network.software.type</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Network/Configuration/Software/Types" id="menu_action_software_type" action="action_software_type"/>
-
- <record model="ir.ui.view" id="view_hardware_type_form">
- <field name="name">network.hardware.type.form</field>
- <field name="model">network.hardware.type</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Hardware Type">
- <field name="name"/>
- <field name="networkable"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_hard_type">
- <field name="res_model">network.hardware.type</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Tools/Network/Configuration/Hardware/Types" id="menu_action_hard_type" action="action_hard_type" groups="admin"/>
-
-
- <record model="ir.ui.view" id="password_form">
- <field name="name">network.software.logpass.form</field>
- <field name="model">network.software.logpass</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Add a password">
- <field name="login" colspan="4"/>
- <field name="password" colspan="4"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="password_tree">
- <field name="name">network.software.logpass.tree</field>
- <field name="model">network.software.logpass</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Passwords">
- <field name="login"/>
- <field name="password"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="software_form">
- <field name="name">network.software.form</field>
- <field name="model">network.software</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Network Softwares">
- <separator string="General Informations" colspan="4"/>
- <field name="name" colspan="4" select="1"/>
- <field name="type"/>
- <field name="date" select="1"/>
- <field name="email" select="1"/>
- <separator string="Login / Password" colspan="4" />
- <field name="logpass" colspan="4" nolabel="1"/>
- <separator string="Notes" colspan="4"/>
- <field name="note" colspan="4" nolabel="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_software_tree">
- <field name="name">network.software.tree</field>
- <field name="model">network.software</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Network Softwares">
- <field name="name"/>
- <field name="type"/>
- <field name="email"/>
- <field name="date"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_network">
- <field name="name">network.network.tree</field>
- <field name="model">network.network</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="All Networks">
- <field name="name" />
- <field name="user_id" />
- <field name="contact_id" />
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="add_view_network">
- <field name="res_model">network.network</field>
- <field name="view_type">tree</field>
- </record>
- <menuitem name="Tools/Network/Network List"
- id="menu_add_view_network" action="add_view_network" groups="admin"/>
-
- <record model="ir.ui.view" id="add_network_view">
- <field name="name">network.network.form</field>
- <field name="model">network.network</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Network Element">
- <separator string="Network Definition" colspan="4"/>
- <field name="name" colspan="4" select="1"/>
- <field name="range" colspan="4" select="1"/>
- <field name="user_id" colspan="4" select="1"/>
- <field name="contact_id" colspan="4" select="1"/>
- <field name="material_ids" nolabel="1" colspan="4" widget="one2many_list">
- <form string="Network Material">
- <notebook>
- <page string="Material Info">
- <separator string="Informations" colspan="4"/>
- <field name="name" colspan="4" select="1"/>
- <field name="type" select="1"/>
- <field name="supplier" select="1" />
- <field name="date" select="1"/>
- <field name="warranty" />
- <field name="parent_id"/>
- <separator string="Softwares" colspan="4"/>
- <field name="software_id" nolabel="1" colspan="4" widget="one2many_list"/>
- </page>
- <page string="Updates">
- <field name="change_id" nolabel="1" colspan="4" widget="one2many_list" />
- </page>
- <page string="Notes">
- <field name="note" nolabel="1" colspan="4"/>
- </page>
- </notebook>
- </form>
- </field>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="add_new_network">
- <field name="res_model">network.network</field>
- <field name="view_type">form</field>
- </record>
- <menuitem name="Tools/Network/Networks" id="menu_add_new_network" action="add_new_network" groups="admin"/>
-
- <record model="ir.ui.view" id="add_diary_entry_form">
- <field name="name">network.changes.form</field>
- <field name="model">network.changes</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Enter a diary entry">
- <separator string="Diary entry" colspan="4" />
- <field name="name" colspan="4" select="1" />
- <field name="date" colspan="4" select="1"/>
- <field name="description" colspan="4" />
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="add_diary_entry_tree">
- <field name="name">network.changes.tree</field>
- <field name="model">network.changes</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Interventions">
- <field name="date"/>
- <field name="name"/>
- </tree>
- </field>
- </record>
- </data>
-</terp>
diff --git a/addons/network/report/material.xml b/addons/network/report/material.xml
deleted file mode 100644
index 7ca21198ed7..00000000000
--- a/addons/network/report/material.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<materials>
- <material type="fields" name="id">
- <material-name type="field" name="name"/>
- <material-date type="field" name="date"/>
- <material-type type="field" name="type.name"/>
- <material-note type="field" name="note"/>
- <softwares>
- <software type="zoom" name="software_id">
- <soft-name type="field" name="name"/>
- <soft-type type="field" name="type.name"/>
- <soft-date type="field" name="date"/>
- <soft-version type="field" name="version" />
- <acces type="zoom" name="logpass">
- <username type="field" name="login" />
- <password type="field" name="password" />
- </acces>
- </software>
- </softwares>
- </material>
-</materials>
diff --git a/addons/network/report/material.xsl b/addons/network/report/material.xsl
deleted file mode 100644
index ad8cfa5d4e1..00000000000
--- a/addons/network/report/material.xsl
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:import href="../../custom/corporate_defaults.xsl"/>
- <xsl:import href="../../base/report/rml_template.xsl"/>
- <xsl:variable name="page_format">a4_normal</xsl:variable>
-
- <xsl:template name="stylesheet">
- <blockTableStyle id="products">
- <blockFont name="Helvetica-BoldOblique" size="12"
- start="0,0" stop="-1,0"/>
- <blockBackground colorName="yellow" start="0,0" stop="-1,0"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="logpass">
- <blockFont name="Helvetica" size="8" start="0,0" stop="-1,-1" />
- <blockBackground colorName="grey" start="0,0" stop="-1,-1" />
- </blockTableStyle>
- </xsl:template>
-
- <xsl:template name="story">
- <xsl:apply-templates select="materials"/>
- </xsl:template>
-
- <xsl:template match="/">
- <xsl:call-template name="rml"/>
- </xsl:template>
-
- <xsl:template match="materials">
- <xsl:apply-templates select="material"/>
- </xsl:template>
-
- <xsl:template match="material">
- <setNextTemplate name="other_pages"/>
- <para>
- <b t="1">Name</b>:
- <i><xsl:value-of select="material-name"/></i>
- </para>
- <para>
- <b t="1">Date</b>:
- <i><xsl:value-of select="material-date"/></i>
- </para>
- <para>
- <b t="1">Type</b>:
- <i><xsl:value-of select="material-type"/></i>
- </para>
- <para>
- <b t="1">Your Contact</b>:
- <i><xsl:value-of select="material-user"/></i>
- </para>
- <para>
- <b t="1">Notes</b>:
- </para>
- <para>
- <i><xsl:value-of select="material-note"/></i>
- </para>
- <spacer length="1cm" width="2mm"/>
- <blockTable colWidths="6cm,3cm,2.5cm,2.5cm" style="products">
- <tr>
- <td t="1">Software</td>
- <td t="1">Type</td>
- <td t="1">Date</td>
- <td t="1">Version</td>
- </tr>
- <xsl:apply-templates name="softwares"/>
- </blockTable>
- <setNextTemplate name="first_page"/>
- <pageBreak/>
- </xsl:template>
-
- <xsl:template match="software">
- <tr>
- <td>
- <xsl:value-of select="soft-name"/>
- </td>
- <td>
- <xsl:value-of select="soft-type"/>
- </td>
- <td>
- <xsl:value-of select="soft-date"/>
- </td>
- <td>
- <xsl:value-of select="soft-version"/>
- </td>
- </tr>
- <xsl:if test="acces">
- <tr>
- <td></td>
- <td t="1">Login / Password</td>
- <td>
- <blockTable colWidths="2.5cm,2.5cm" style="logpass">
- <xsl:for-each select="acces">
- <tr>
- <td><xsl:value-of select="username" /></td>
- <td><xsl:value-of select="password" /></td>
- </tr>
- </xsl:for-each>
- </blockTable>
- </td>
- </tr>
- <tr></tr>
- </xsl:if>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/addons/network/report/network.xml b/addons/network/report/network.xml
deleted file mode 100644
index 063cc0b0c39..00000000000
--- a/addons/network/report/network.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<networks>
- <network type="fields" name="id">
- <network-name type="field" name="name" />
- <network-range type="field" name="range" />
- <partner type="zoom" name="contact_id">
- <name type="field" name="name" />
- <title type="field" name="title" />
- <address type="zoom" name="address">
- <name type="field" name="name" />
- <street type="field" name="street" />
- <postcode type="field" name="zip" />
- <city type="field" name="city" />
- <country type="field" name="country_id.name" />
- </address>
- </partner>
- <materials>
- <material type="zoom" name="material_ids">
- <material-name type="field" name="name"/>
- <material-date type="field" name="date"/>
- <material-type type="field" name="type.name"/>
- <material-note type="field" name="note"/>
- <material-supplier type="field" name="supplier" />
- <material-warranty type="field" name="warranty" />
- <softwares>
- <software type="zoom" name="software_id">
- <soft-name type="field" name="name"/>
- <soft-type type="field" name="type.name"/>
- <soft-date type="field" name="date"/>
- <soft-version type="field" name="version" />
- <acces type="zoom" name="logpass">
- <username type="field" name="login" />
- <password type="field" name="password" />
- </acces>
- </software>
- </softwares>
- </material>
- </materials>
- </network>
-</networks>
-
diff --git a/addons/network/report/network.xsl b/addons/network/report/network.xsl
deleted file mode 100644
index b8fc4aa0852..00000000000
--- a/addons/network/report/network.xsl
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:import href="../../custom/corporate_defaults.xsl"/>
- <xsl:import href="../../base/report/rml_template.xsl"/>
- <xsl:variable name="page_format">a4_letter</xsl:variable>
-
- <xsl:template name="stylesheet">
- <blockTableStyle id="products">
- <blockFont name="Helvetica-BoldOblique" size="12"
- start="0,0" stop="-1,0"/>
- <blockBackground colorName="yellow" start="0,0" stop="-1,0"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="logpass">
- <blockFont name="Helvetica" size="8" start="0,0" stop="-1,-1" />
- <blockBackground colorName="grey" start="0,0" stop="-1,-1" />
- </blockTableStyle>
- </xsl:template>
-
- <xsl:template name="story">
- <xsl:apply-templates select="networks"/>
- </xsl:template>
-
- <xsl:template match="/">
- <xsl:call-template name="rml"/>
- </xsl:template>
-
- <xsl:template match="network">
- <setNextTemplate name="other_pages"/>
- <para>
- <xsl:value-of select="partner/title" />
- <xsl:text> </xsl:text>
- <xsl:value-of select="partner/name"/>
- </para>
- <para>
- <xsl:value-of select="partner/address/name"/>
- </para>
- <para>
- <xsl:value-of select="partner/address/street"/>
- </para>
- <para>
- <xsl:value-of select="partner/address/postcode"/>
- <xsl:value-of select="partner/address/city"/>
- </para>
- <para>
- <xsl:value-of select="partner/address/country"/>
- </para>
- <nextFrame />
- <para t="1">
- Hello,
- </para>
- <para t="1">
- Here is the list of the software and hardware parts we installed during our last intervention.
- </para>
- <spacer length="1cm" />
- <xsl:apply-templates select="materials/material" />
- </xsl:template>
-
- <xsl:template match="materials">
- <xsl:apply-templates select="material"/>
- </xsl:template>
-
- <xsl:template match="material">
- <blockTable colWidths="16cm">
- <tr>
- <td>
- <para>
- <b t="1">Name</b>:
- <i><xsl:value-of select="material-name"/></i>
- </para>
- <para>
- <b t="1">Type</b>:
- <i><xsl:value-of select="material-type"/></i>
- </para>
- <para>
- <b t="1">Date</b>:
- <i><xsl:value-of select="material-date"/></i>
- </para>
- <para>
- <b t="1">Warranty date</b>:
- <i><xsl:value-of select="material-warranty" /></i>
- </para>
- <para>
- <b t="1">Your Contact</b>:
- <i><xsl:value-of select="material-user"/></i>
- </para>
- </td>
- </tr>
- </blockTable>
- <para>
- <i><xsl:value-of select="material-note"/></i>
- </para>
- <spacer length="1cm" width="2mm"/>
- <blockTable colWidths="6cm,3cm,2.5cm,2.5cm" style="products">
- <tr>
- <td t="1">Software</td>
- <td t="1">Type</td>
- <td t="1">Date</td>
- <td t="1">Version</td>
- </tr>
- <xsl:apply-templates name="softwares/software"/>
- </blockTable>
- <pageBreak/>
- </xsl:template>
-
- <xsl:template match="software">
- <tr>
- <td>
- <xsl:value-of select="soft-name"/>
- </td>
- <td>
- <xsl:value-of select="soft-type"/>
- </td>
- <td>
- <xsl:value-of select="soft-date"/>
- </td>
- <td>
- <xsl:value-of select="soft-version"/>
- </td>
- </tr>
- <xsl:if test="acces">
- <tr>
- <td></td>
- <td t="1">Login / Password</td>
- <td>
- <blockTable colWidths="2.5cm,2.5cm" style="logpass">
- <xsl:for-each select="acces">
- <tr>
- <td><xsl:value-of select="username" /></td>
- <td><xsl:value-of select="password" /></td>
- </tr>
- </xsl:for-each>
- </blockTable>
- </td>
- </tr>
- <tr></tr>
- </xsl:if>
- </xsl:template>
-</xsl:stylesheet>
-
diff --git a/addons/network/report/network_list.xml b/addons/network/report/network_list.xml
deleted file mode 100644
index 6df2e216fff..00000000000
--- a/addons/network/report/network_list.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<networks>
- <network type="fields" name="id">
- <network-name type="field" name="name" />
- <network-range type="field" name="range" />
- <partner type="zoom" name="contact_id">
- <name type="field" name="name" />
- <address type="zoom" name="address">
- <name type="field" name="name" />
- <street type="field" name="street" />
- <postcode type="field" name="zip" />
- <city type="field" name="city" />
- <country type="field" name="country_id.name" />
- </address>
- </partner>
- <onsite type="zoom" name="user_id">
- <name type="field" name="name" />
- </onsite>
- </network>
-</networks>
-
diff --git a/addons/network/report/network_list.xsl b/addons/network/report/network_list.xsl
deleted file mode 100644
index 406909d93b5..00000000000
--- a/addons/network/report/network_list.xsl
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:import href="../../custom/corporate_defaults.xsl"/>
- <xsl:import href="../../base/report/rml_template.xsl"/>
- <xsl:variable name="page_format">a4_normal</xsl:variable>
-
- <xsl:template name="stylesheet">
- <blockTableStyle id="network_list">
- <blockFont name="Helvetica-BoldOblique" size="12"
- start="0,0" stop="-1,0"/>
- <blockBackground colorName="yellow" start="0,0" stop="-1,0"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- </xsl:template>
-
- <xsl:template name="first_page_frames">
- <frame id="main" x1="1cm" y1="3.5cm" width="19.0cm" height="21.5cm" />
- </xsl:template>
-
- <xsl:template match="/">
- <xsl:call-template name="rml"/>
- </xsl:template>
-
- <xsl:template name="story">
- <blockTable colWidths="5cm,5cm,5cm" style="network_list">
- <tr>
- <td t="1">Partner</td>
- <td t="1">Network name</td>
- <td t="1">Onsite contact</td>
- </tr>
- <xsl:for-each select="/networks/network">
- <tr>
- <td>
- <xsl:value-of select="partner/name" />
- </td>
- <td>
- <xsl:value-of select="network-name" />
- </td>
- <td>
- <xsl:value-of select="onsite/name" />
- </td>
- </tr>
- </xsl:for-each>
- </blockTable>
- <xsl:apply-templates select="networks"/>
- </xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/addons/partner_ldap/__init__.py b/addons/partner_ldap/__init__.py
deleted file mode 100644
index 8a8bc0fa9bf..00000000000
--- a/addons/partner_ldap/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-import partner
-import wizard
diff --git a/addons/partner_ldap/__terp__.py b/addons/partner_ldap/__terp__.py
deleted file mode 100644
index c63f7729571..00000000000
--- a/addons/partner_ldap/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "Partner extension to synchronize TinyERP with ldap",
- "version" : "1.0",
- "author" : "Tiny",
- "depends" : ["base"],
- "category" : "Generic Modules/Inventory Control",
- "description": "Synchronise partners through a LDAP module. Has been used to synchronise partners in Outlook and Tiny ERP.",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["wizard.xml"],
- "active": False,
- "installable": False
-}
diff --git a/addons/partner_ldap/partner.py b/addons/partner_ldap/partner.py
deleted file mode 100644
index 112dbe7e67c..00000000000
--- a/addons/partner_ldap/partner.py
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-
-class address_ldap(osv.osv):
- _inherit = 'res.partner.address'
-
- _columns = {
- 'dn' : fields.char('Distinguished name', size=128),
- }
-
-address_ldap()
diff --git a/addons/partner_ldap/wizard.xml b/addons/partner_ldap/wizard.xml
deleted file mode 100644
index 1785d5c7328..00000000000
--- a/addons/partner_ldap/wizard.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <wizard string="Synchronize with ldap" model="res.partner.address" name="partners.sync_ldap" id="wizard_ldap_sync" />
- <menuitem name="Partners/Synchronize With Ldap" action="wizard_ldap_sync" type="wizard" />
- </data>
-</terp>
diff --git a/addons/partner_ldap/wizard/__init__.py b/addons/partner_ldap/wizard/__init__.py
deleted file mode 100644
index b3191c25201..00000000000
--- a/addons/partner_ldap/wizard/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import synchronize
diff --git a/addons/partner_ldap/wizard/synchronize.py b/addons/partner_ldap/wizard/synchronize.py
deleted file mode 100644
index 0714a76cf4f..00000000000
--- a/addons/partner_ldap/wizard/synchronize.py
+++ /dev/null
@@ -1,147 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sys
-if sys.version_info[:2] < (2, 4):
- from sets import Set as set
-
-import time
-import ldap
-import ldap.modlist
-
-import wizard
-import pooler
-
-BASE_DN = 'ou=addressbook,dc=localdomain'
-
-def terp2ldap(data):
- res = {}
- for ldap_name, terp in LDAP_TERP_MAPPER.items():
- if callable(terp) and terp(data):
- res[ldap_name] = [terp(data)]
- elif isinstance(terp, basestring) and data[terp]:
- res[ldap_name] = ['%s' % data[terp]]
- return res
-
-def get_lastname(dico):
- lnames = dico['name'].split(' ', 1)[1:]
- if lnames:
- return ' '.join(lnames)
- else:
- return dico['name']
-
-def get_street(dico):
- return ' '.join([dico[x] for x in ('street', 'street2') if dico[x]])
-
-def get_name(attribute):
- def func(dico):
- return dico[attribute][1]
- return func
-
-
-LDAP_TERP_MAPPER = {
- 'displayname': 'name',
- 'mail': 'email',
- 'o': get_name('partner_id'),
- 'telephoneNumber': 'phone',
- 'street': get_street,
- 'postalcode': 'zip',
- 'l': 'city',
- 'cn': 'name',
- 'sn': get_lastname,
- 'uid': 'id',
- }
-
-
-class sync_ldap(wizard.interface):
-
- _login_arch = '''<?xml version="1.0" ?>
- <form string="LDAP Credentials">
- <field name="ldap_host" colspan="4" />
- <field name="dn" colspan="4" />
- <field name="password" colspan="4" />
- </form>
- '''
-
- _login_fields = {
- 'ldap_host': {'string': 'LDAP Host', 'type': 'char', 'size': 128},
- 'dn': {'string': 'Distinguished name', 'type': 'char', 'size': 128},
- 'password': {'string': 'Password', 'type': 'char', 'size': 128},
- }
-
- def _do_sync(self, cr, uid, data, context):
- l = ldap.open(data['form']['ldap_host'])
- l.simple_bind_s(data['form']['dn'], data['form']['password'])
- ldap_objs = dict(l.search_s(BASE_DN, ldap.SCOPE_ONELEVEL, 'objectclass=*',
- LDAP_TERP_MAPPER.keys()))
- address = pooler.get_pool(cr.dbname).get('res.partner.address')
- terp_objs = dict([(x['id'], x) for x in address.read(cr, uid, address.search(cr, uid, []))])
- ldap_set = [int(x['uid'][0]) for x in ldap_objs.values()]
- terp_set = terp_objs.keys()
- for to_delete in ldap_set:
- if to_delete in terp_set:
- continue
- l.delete_s('uid=%s,%s' % (to_delete, BASE_DN))
- for to_add in terp_set:
- if to_add in ldap_set:
- continue
- new_dn = 'uid=%s,%s' % (to_add, BASE_DN)
- ldap_data = {'objectclass' : ['organizationalPerson', 'inetOrgPerson']}
- ldap_data.update(terp2ldap(terp_objs[to_add]))
- l.add_s(new_dn, ldap.modlist.addModlist(ldap_data))
- address.write(cr, uid, [to_add], {'dn' : new_dn})
- for to_update in terp_set:
- if to_update not in ldap_set:
- continue
- current_dn = 'uid=%s,%s' % (to_update, BASE_DN)
- modlist = ldap.modlist.modifyModlist(ldap_objs[current_dn], terp2ldap(terp_objs[to_update]))
- if modlist:
- l.modify_s(current_dn, modlist)
- return {}
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {
- 'type' : 'form',
- 'arch' : _login_arch,
- 'fields' : _login_fields,
- 'state' : (('end', 'Cancel'),('sync', 'Synchronize'))
- },
- },
- 'sync' : {
- 'actions' : [ _do_sync ],
- 'result' : { 'type' : 'state', 'state' : 'end' },
- },
- }
-
-
-sync_ldap('partners.sync_ldap')
-
-# vim:noexpandtab:
diff --git a/addons/product_electronic/__init__.py b/addons/product_electronic/__init__.py
deleted file mode 100644
index 5dd79f895b6..00000000000
--- a/addons/product_electronic/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: __init__.py 2102 2006-01-11 20:38:55Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import product_electronic
diff --git a/addons/product_electronic/__terp__.py b/addons/product_electronic/__terp__.py
deleted file mode 100644
index 288cf5a554e..00000000000
--- a/addons/product_electronic/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "Products Attributes & Manufacturers",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Enterprise Specific Modules/Electronic Industries",
- "depends" : ["base", "account", "product", "stock"],
- "init_xml" : [],
- "demo_xml" : [],
- "description": "A module that add manufacturers and attributes on the product form",
- "update_xml" : ["product_electronic_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/product_electronic/product_electronic.py b/addons/product_electronic/product_electronic.py
deleted file mode 100644
index a4221772d31..00000000000
--- a/addons/product_electronic/product_electronic.py
+++ /dev/null
@@ -1,53 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product_expiry.py 2103 2006-01-11 21:01:14Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class product_product(osv.osv):
- _inherit = 'product.product'
- _name = 'product.product'
- _columns = {
- 'manufacturer' : fields.many2one('res.partner', 'Manufacturer'),
- 'manufacturer_pname' : fields.char('Manufacturer product name', size=64),
- 'manufacturer_pref' : fields.char('Manufacturer product code', size=64),
- 'attribute_ids': fields.one2many('product.electronic.attribute', 'product_id', 'Attributes'),
- }
-product_product()
-
-class product_attribute(osv.osv):
- _name = "product.electronic.attribute"
- _description = "Product attributes"
- _columns = {
- 'name' : fields.char('Attribute', size=64, required=True),
- 'value' : fields.char('Value', size=64),
- 'product_id': fields.many2one('product.product', 'Product', ondelete='cascade'),
- }
-product_attribute()
-
-
diff --git a/addons/product_electronic/product_electronic_view.xml b/addons/product_electronic/product_electronic_view.xml
deleted file mode 100644
index 92d97e65370..00000000000
--- a/addons/product_electronic/product_electronic_view.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
-
- <record model="ir.ui.view" id="view_product_form_expiry">
- <field name="name">product.normal.form</field>
- <field name="model">product.product</field>
- <field name="inherit_id" ref="product.product_normal_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <notebook position="inside">
- <page string="Manufacturing Data">
- <separator string="Manufacturing data" colspan="4" />
- <field name="manufacturer_pname" string="Product name" colspan="4" />
- <field name="manufacturer" />
- <field name="manufacturer_pref" string="Product reference"/>
-
- <separator string="Attributes" colspan="4"/>
- <field name="attribute_ids" colspan="4" nolabel="1" widget="one2many_list" />
- </page>
- </notebook>
- </field>
- </record>
-
- <record model="ir.ui.view" id="product_electronic_attribute_tree_view">
- <field name="name">product.electronic.attribute.tree</field>
- <field name="model">product.electronic.attribute</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Product Template Name">
- <field name="name"/>
- <field name="value"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="product_electronic_attribute_form_view">
- <field name="name">product.electronic.attribute.form</field>
- <field name="model">product.electronic.attribute</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Product Template Name">
- <field name="name" select="1"/>
- <field name="value" select="1"/>
- </form>
- </field>
- </record>
-
- </data>
-</terp>
-
diff --git a/addons/product_expiry/__init__.py b/addons/product_expiry/__init__.py
deleted file mode 100644
index 78d3adafcea..00000000000
--- a/addons/product_expiry/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import product_expiry
diff --git a/addons/product_expiry/__terp__.py b/addons/product_expiry/__terp__.py
deleted file mode 100644
index 1a79ecca9fd..00000000000
--- a/addons/product_expiry/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "Products date of expiry",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Enterprise Specific Modules/Food Industries",
- "depends" : ["base", "account", "product", "stock"],
- "init_xml" : [],
- "demo_xml" : ["product_expiry_demo.xml"],
- "description": "Track different dates on products and lots. Used, for exampel, in food industries: expiry date, alert date, date of removal, eso.",
- "update_xml" : ["product_expiry_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py
deleted file mode 100644
index aadd8a4e622..00000000000
--- a/addons/product_expiry/product_expiry.py
+++ /dev/null
@@ -1,73 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import datetime
-from osv import fields,osv
-import pooler
-
-class stock_production_lot(osv.osv):
- _name = 'stock.production.lot'
- _inherit = 'stock.production.lot'
-
- def _get_date(dtype):
- def calc_date(self, cr, uid, context={}):
- if context.get('product_id', False):
- product = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, [context['product_id']])[0]
- duree = getattr(product, dtype) or 0
- date = datetime.datetime.today() + datetime.timedelta(days=duree)
- return date.strftime('%Y-%m-%d %H:%M:%S')
- else:
- return False
- return calc_date
-
- _columns = {
- 'dlc': fields.datetime('Product usetime'),
- 'dluo': fields.datetime('DLUO'),
- 'removal_date': fields.datetime('Removal date'),
- 'alert_date': fields.datetime('Alert date'),
- }
-
- _defaults = {
- 'dlc': _get_date('life_time'),
- 'dluo': _get_date('use_time'),
- 'removal_date': _get_date('removal_time'),
- 'alert_date': _get_date('alert_time'),
- }
-stock_production_lot()
-
-class product_product(osv.osv):
- _inherit = 'product.product'
- _name = 'product.product'
- _columns = {
- 'life_time': fields.integer('Product lifetime'),
- 'use_time': fields.integer('Product usetime'),
- 'removal_time': fields.integer('Product removal time'),
- 'alert_time': fields.integer('Product alert time'),
- }
-product_product()
diff --git a/addons/product_expiry/product_expiry_demo.xml b/addons/product_expiry/product_expiry_demo.xml
deleted file mode 100644
index ad757f52022..00000000000
--- a/addons/product_expiry/product_expiry_demo.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<terp>
- <data noupdate="1">
-
- <record id="product_uom_categ_vol" model="product.uom.categ">
- <field name="name">LTR</field>
- </record>
- <record id="product_uom_ltr" model="product.uom">
- <field name="category_id" ref="product_uom_categ_vol"/>
- <field name="name">LTR</field>
- </record>
-
- <record id="product_product_jambon" model="product.product">
- <field name="supply_method">buy</field>
- <field name="list_price">7.0</field>
- <field name="standard_price">5.0</field>
- <field name="uom_id" ref="product.product_uom_unit"/>
- <field name="uom_po_id" ref="product.product_uom_unit"/>
- <field name="uos_id" ref="product.product_uom_kgm" />
- <field name="uos_coeff">3</field>
- <field name="name">French cheese Camenbert</field>
- <field name="life_time">15</field>
- <field name="use_time">10</field>
- <field name="removal_time">6</field>
- <field name="alert_time">5</field>
- <field name="default_code">JKB</field>
- <field name="ean13">3307630302014</field>
- <field name="categ_id" search="[]" model="product.category"/>
- </record>
- <record model="product.packaging">
- <field name="name">box of 10</field>
- <field name="qty">12</field>
- <field name="ul" ref="product.product_ul_box" />
- <field name="ul_qty">6</field>
- <field name="rows">4</field>
- <field name="product_id" ref="product_product_jambon" />
- <field name="ean">12345678901234</field>
- <field name="weight">10</field>
- <field name="weight_ul">240</field>
- </record>
-
- <record id="product_product_from" model="product.product">
- <field name="supply_method">buy</field>
- <field name="list_price">8.0</field>
- <field name="standard_price">6.0</field>
- <field name="uom_id" ref="product.product_uom_unit"/>
- <field name="uom_po_id" ref="product.product_uom_unit"/>
- <field name="uos_id" ref="product.product_uom_kgm" />
- <field name="uos_coeff">0.5</field>
- <field name="name">Ham</field>
- <field name="life_time">30</field>
- <field name="use_time">25</field>
- <field name="removal_time">20</field>
- <field name="alert_time">19</field>
- <field name="default_code">FKS</field>
- <field name="ean13">3307631101876</field>
- <field name="categ_id" search="[]" model="product.category"/>
- </record>
- <record model="product.packaging">
- <field name="name">Box of 5</field>
- <field name="qty">12</field>
- <field name="ul" ref="product.product_ul_box" />
- <field name="ul_qty">6</field>
- <field name="rows">4</field>
- <field name="product_id" ref="product_product_from" />
- <field name="ean">12345678901234</field>
- <field name="weight">10</field>
- <field name="weight_ul">240</field>
- </record>
-
- <record id="product_product_pain" model="product.product">
- <field name="supply_method">buy</field>
- <field name="list_price">8.0</field>
- <field name="standard_price">6.0</field>
- <field name="uom_id" ref="product.product_uom_unit"/>
- <field name="uom_po_id" ref="product.product_uom_unit"/>
- <field name="uos_id" ref="product.product_uom_unit" />
- <field name="uos_coeff">0.5</field>
- <field name="name">Bread</field>
- <field name="life_time">30</field>
- <field name="use_time">25</field>
- <field name="removal_time">20</field>
- <field name="alert_time">19</field>
- <field name="default_code">PKB</field>
- <field name="ean13">3307631102323</field>
- <field name="categ_id" search="[]" model="product.category"/>
- </record>
- <record model="product.packaging">
- <field name="name">Bag of 2</field>
- <field name="qty">6</field>
- <field name="ul" ref="product.product_ul_box" />
- <field name="ul_qty">6</field>
- <field name="rows">4</field>
- <field name="product_id" ref="product_product_pain" />
- <field name="ean">12345678901234</field>
- <field name="weight">10</field>
- <field name="weight_ul">240</field>
- </record>
-
- <record id="product_product_lait" model="product.product">
- <field name="supply_method">buy</field>
- <field name="list_price">8.0</field>
- <field name="standard_price">6.0</field>
- <field name="uom_id" ref="product.product_uom_unit"/>
- <field name="uom_po_id" ref="product.product_uom_unit"/>
- <field name="uos_id" ref="product_uom_ltr" />
- <field name="uos_coeff">0.5</field>
- <field name="name">Cow milk</field>
- <field name="life_time">30</field>
- <field name="use_time">25</field>
- <field name="removal_time">20</field>
- <field name="alert_time">19</field>
- <field name="default_code">LEX</field>
- <field name="ean13">3307630302045</field>
- <field name="categ_id" search="[]" model="product.category"/>
- </record>
- <record model="product.packaging">
- <field name="name">Boxes of 1liter</field>
- <field name="qty">4</field>
- <field name="ul" ref="product.product_ul_box" />
- <field name="ul_qty">6</field>
- <field name="rows">4</field>
- <field name="product_id" ref="product_product_lait" />
- <field name="ean">12345678901234</field>
- <field name="weight">10</field>
- <field name="weight_ul">240</field>
- </record>
- </data>
-</terp>
diff --git a/addons/product_expiry/product_expiry_view.xml b/addons/product_expiry/product_expiry_view.xml
deleted file mode 100644
index 2f21ba859a4..00000000000
--- a/addons/product_expiry/product_expiry_view.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <record model="ir.ui.view" id="view_move_form_expiry">
- <field name="name">stock.production.lot.form</field>
- <field name="model">stock.production.lot</field>
- <field name="inherit_id" ref="stock.view_production_lot_form" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <field name="date" position="after">
- <field name="alert_date" />
- <field name="removal_date" />
- <field name="dluo" />
- <field name="dlc" />
- <separator string="Dates" colspan="4" />
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_product_form_expiry">
- <field name="name">product.normal.form</field>
- <field name="model">product.product</field>
- <field name="inherit_id" ref="product.product_normal_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <notebook position="inside">
- <page string="Dates">
- <separator string="Dates" colspan="4" />
- <field name="life_time" />
- <field name="use_time" />
- <field name="removal_time" />
- <field name="alert_time" />
- </page>
- </notebook>
- </field>
- </record>
- </data>
-</terp>
-
diff --git a/addons/product_extended/__init__.py b/addons/product_extended/__init__.py
deleted file mode 100644
index 00baa1349ff..00000000000
--- a/addons/product_extended/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import product_extended
diff --git a/addons/product_extended/__terp__.py b/addons/product_extended/__terp__.py
deleted file mode 100644
index a8f0a1b1177..00000000000
--- a/addons/product_extended/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Product extension to track sales and purchases",
- "version" : "1.0",
- "author" : "Tiny",
- "depends" : ["product", "purchase", "sale"],
- "category" : "Generic Modules/Inventory Control",
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["product_extended_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/product_extended/product_extended.py b/addons/product_extended/product_extended.py
deleted file mode 100644
index bf7fdf0a8af..00000000000
--- a/addons/product_extended/product_extended.py
+++ /dev/null
@@ -1,138 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields
-from osv import osv
-import ir
-import pooler
-
-class product_supplierinfo(osv.osv):
- _inherit = 'product.supplierinfo'
- _name = "product.supplierinfo"
-
- def _last_order(self, cr, uid, ids, name, arg, context):
- res = {}
- for supinfo in self.browse(cr, uid, ids):
- cr.execute("select po.id, max(po.date_approve) from purchase_order as po, purchase_order_line as line where po.id=line.order_id and product_id=%d and partner_id=%d and state='approved' group by po.id", (supinfo.product_id.id, supinfo.name.id,))
- record = cr.fetchone()
- if record:
- res[supinfo.id] = record[0]
- else:
- res[supinfo.id] = False
- return res
-
- def _last_order_date(self, cr, uid, ids, name, arg, context):
- res = {}
- po = self.pool.get('purchase.order')
- last_orders = self._last_order(cr, uid, ids, name, arg, context)
- dates = po.read(cr, uid, filter(None, last_orders.values()), ['date_approve'])
- for suppinfo in ids:
- date_approve = [x['date_approve'] for x in dates if x['id']==last_orders[suppinfo]]
- if date_approve:
- res[suppinfo] = date_approve[0]
- else:
- res[suppinfo] = False
- return res
-
- _columns = {
- 'last_order' : fields.function(_last_order, type='many2one', obj='purchase.order', method=True, string='Last Order'),
- 'last_order_date' : fields.function(_last_order_date, type='date', method=True, string='Last Order date'),
- }
-product_supplierinfo()
-
-
-class product_product(osv.osv):
- _name = 'product.product'
- _inherit = 'product.product'
-
- def _find_op(self, cr, uid, ids, name, arg, context):
- res = {}
- for product_id in ids:
- cr.execute('SELECT swo.id from stock_warehouse_orderpoint AS swo WHERE product_id=%d', (product_id,))
- op_id = cr.fetchone()
- if op_id:
- res[product_id] = op_id[0]
- else:
- res[product_id] = False
- return res
-
- def _product_dispo(self, cr, uid, ids, name, arg, context={}):
- res = {}
- out = self._product_outgoing_qty(cr, uid, ids, name, arg, context)
- now = self._product_qty_available(cr, uid, ids, name, arg, context)
- for p_id in ids:
- res[p_id] = now[p_id] + out[p_id]
- return res
-
-
- _columns = {
- 'calculate_price': fields.boolean('Compute price'),
- 'orderpoint_ids': fields.one2many('stock.warehouse.orderpoint', 'product_id', 'Orderpoints'),
- 'qty_dispo': fields.function(_product_dispo, method=True, type='float', string='Stock available'),
- }
-
- _defaults = {
- 'calculate_price': lambda w,x,y,z: False,
- }
-
- def compute_price(self, cr, uid, ids, *args):
- for prod_id in ids:
- bom_ids = pooler.get_pool(cr.dbname).get('mrp.bom').search(cr, uid, [('product_id', '=', prod_id)])
- if bom_ids:
- for bom in pooler.get_pool(cr.dbname).get('mrp.bom').browse(cr, uid, bom_ids):
- self._calc_price(cr, uid, bom)
- return True
-
- def _calc_price(self, cr, uid, bom):
- if not bom.product_id.calculate_price:
- return bom.product_id.standard_price
- else:
- price = 0
- if bom.bom_lines:
- for sbom in bom.bom_lines:
- price += self._calc_price(cr, uid, sbom) * sbom.product_qty
- else:
- bom_obj = pooler.get_pool(cr.dbname).get('mrp.bom')
- no_child_bom = bom_obj.search(cr, uid, [('product_id', '=', bom.product_id.id), ('bom_id', 'is', None)])
- if no_child_bom:
- other_bom = bom_obj.browse(cr, uid, no_child_bom)[0]
- price += bom.product_qty * self._calc_price(cr, uid, other_bom)
- else:
- price += bom.product_qty * bom.product_id.standard_price
-
- if bom.routing_id:
- for wline in bom.routing_id.workcenter_lines:
- wc = wline.workcenter_id
- cycle = wline.cycle_nbr
- hour = (wc.time_start + wc.time_stop + cycle * wc.time_cycle) * (wc.time_efficiency or 1.0)
- price += wc.costs_cycle * cycle + wc.costs_hour * hour
- if bom.bom_lines:
- self.write(cr, uid, [bom.product_id.id], {'standard_price' : price})
- return price
-product_product()
diff --git a/addons/product_extended/product_extended_view.xml b/addons/product_extended/product_extended_view.xml
deleted file mode 100644
index d67a39dc350..00000000000
--- a/addons/product_extended/product_extended_view.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <record model="ir.ui.view" id="product_supplierinfo_ext_form_view">
- <field name="name">product_extended.supplierinfo.form.view</field>
- <field name="type">form</field>
- <field name="model">product.supplierinfo</field>
- <field name="inherit_id" ref="product.product_supplierinfo_form_view" />
- <field name="arch" type="xml">
- <field name="qty" position="after">
- <field name="last_order" colspan="4"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="product_supplierinfo_ext_tree_view">
- <field name="name">product_extended.supplierinfo.tree.view</field>
- <field name="type">tree</field>
- <field name="model">product.supplierinfo</field>
- <field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
- <field name="arch" type="xml">
- <field name="name" position="after">
- <field name="last_order_date" />
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="product_product_ext_form_view">
- <field name="name">product_extended.product.form.view</field>
- <field name="type">form</field>
- <field name="model">product.product</field>
- <field name="priority">2</field>
- <field name="inherit_id" ref="product.product_normal_form_view" />
- <field name="arch" type="xml">
- <field name="uom_po_id" position="after">
- <field name="qty_dispo" />
- <field name="virtual_available" />
- <field name="qty_available" />
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="product_product_ext_form_view2">
- <field name="name">product_extended.product.form.view</field>
- <field name="model">product.product</field>
- <field name="type">form</field>
- <field name="priority">3</field>
- <field name="inherit_id" ref="product.product_normal_form_view" />
- <field name="arch" type="xml">
- <field name="seller_ids" position="before">
- <field name="calculate_price" />
- <button name="compute_price" type="object" string="Compute standard price"/>
- </field>
- </field>
- </record>
- </data>
-</terp>
-
diff --git a/addons/product_variant/__init__.py b/addons/product_variant/__init__.py
deleted file mode 100644
index 10f28f993d9..00000000000
--- a/addons/product_variant/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: product.py 1310 2005-09-08 20:40:15Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import product_variant
diff --git a/addons/product_variant/__terp__.py b/addons/product_variant/__terp__.py
deleted file mode 100644
index 466d98156da..00000000000
--- a/addons/product_variant/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Products with multi-level variants",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Inventory Control",
- "depends" : ["product"],
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : [],
- "active": False,
- "installable": False
-}
diff --git a/addons/product_variant/product_variant.py b/addons/product_variant/product_variant.py
deleted file mode 100644
index d535b27b751..00000000000
--- a/addons/product_variant/product_variant.py
+++ /dev/null
@@ -1,84 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-
-#
-# Dimensions Definition
-#
-class product_variant_dimension_type(osv.osv):
- _name = "product.variant.dimension.type"
- _description = "Dimension Type"
- _columns = {
- 'name' : fields.char('Dimension', size=64),
- 'sequence' : fields.integer('Sequence'),
- 'value_ids' : fields.one2many('product.variant.dimension.value', 'Dimension Values'),
- }
- _order = "sequence, name"
-product_variant_dimension_type()
-
-class product_variant_dimension_value(osv.osv):
- _name = "product.variant.dimension.value"
- _description = "Dimension Type"
- _columns = {
- 'name' : fields.char('Dimension Value', size=64),
- 'sequence' : fields.integer('Sequence'),
- 'price_extra' : fields.float('Dimension Values', size=64),
- 'price_margin' : fields.float('Dimension Values', size=64),
- 'dimension_id' : fields.many2one('product.product.dimension.type', 'Dimension', required=True),
- }
- _order = "sequence, name"
-product_variant_dimension_value()
-
-#
-# Dimensions Definition
-#
-
-class product_product(osv.osv):
- _name = "product.product"
- _inherit = "product.product"
-
- def _variant_name_get(self, cr, uid, ids, name, arg, context={}):
- res = {}
- for p in self.browse(cr, uid, ids, context):
- r = map(lambda dim: (dim.dimension_id.name or '')+'/'+(dim.name or '-'), p.dimension_ids)
- res[p.id] = ','.join(r)
- return res
-
- _columns = {
- 'dimension_ids': fields.many2many('product.variant.dimension.value', 'product_product_dimension_rel', 'product_id','dimension_id', 'Dimensions'),
- #
- # TODO: compute price_extra and _margin based on variants
- #
- # 'price_extra': fields.function('Price Extra'),
- # 'price_margin': fields.function('Price Margin'),
- #
- 'variants': fields.function(_variant_name_get, method=True, type='char', string='Variants'),
- }
-product_product()
-
-
diff --git a/addons/productivity_analysis/__init__.py b/addons/productivity_analysis/__init__.py
deleted file mode 100644
index 19d8a98198f..00000000000
--- a/addons/productivity_analysis/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import productivity_analysis
-import report
-import wizard
-
diff --git a/addons/productivity_analysis/__terp__.py b/addons/productivity_analysis/__terp__.py
deleted file mode 100644
index 60cee8ebe89..00000000000
--- a/addons/productivity_analysis/__terp__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name" : "Productivity Analysis",
- "version" : "1.0",
- "depends" : ["base"],
- "author" : "Tiny",
- "website" : "",
- "category" : "Generic Modules/Human Resources",
- "description": "A module that analyse the productivity of Tiny ERP users in terms of creation and modification of objects. It is able to render graphs, compare users, eso.",
- "init_xml" : [ ],
- "demo_xml" : [ ],
- "update_xml" : [
- "productivity_analysis_view.xml",
- "productivity_analysis_wizard.xml",
- "productivity_analysis_report.xml",
- ],
- "active": False,
- "installable": True
-}
diff --git a/addons/productivity_analysis/productivity_analysis.py b/addons/productivity_analysis/productivity_analysis.py
deleted file mode 100644
index 666cc5d9ffb..00000000000
--- a/addons/productivity_analysis/productivity_analysis.py
+++ /dev/null
@@ -1,45 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-
-class productivity_analysis_models(osv.osv):
- _name = "productivity_analysis.models"
- _description = "Objects for Productivity Analysis"
- _columns = {
- 'name': fields.char('Model Name', size=64, required=True),
- 'model': fields.char('Model', size=64, required=True),
- 'active': fields.boolean('Active')
- }
- _defaults = {
- 'active': lambda *a: 1,
- }
- _order = "name"
-productivity_analysis_models()
-
-
diff --git a/addons/productivity_analysis/productivity_analysis_report.xml b/addons/productivity_analysis/productivity_analysis_report.xml
deleted file mode 100644
index e2ac1bd1a22..00000000000
--- a/addons/productivity_analysis/productivity_analysis_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report
- id="report_productivity_analysis_models"
- string="Users Productivity Analysis"
- model="productivity_analysis.models"
- name="productivity_analysis.models"/>
- </data>
-</terp>
-
diff --git a/addons/productivity_analysis/productivity_analysis_view.xml b/addons/productivity_analysis/productivity_analysis_view.xml
deleted file mode 100644
index 698d05a0cfc..00000000000
--- a/addons/productivity_analysis/productivity_analysis_view.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <menuitem name="Reporting" groups="admin"/>
-
- <record model="ir.ui.view" id="view_productivity_analysis_models_form">
- <field name="name">productivity_analysis.models.form</field>
- <field name="model">productivity_analysis.models</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Productivity Analysis Objects">
- <field name="name" select="1"/>
- <field name="active" select="1"/>
- <field name="model"/>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_productivity_analysis_models_form">
- <field name="name">productivity_analysis.models.action.form</field>
- <field name="res_model">productivity_analysis.models</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_productivity_analysis_models_form" />
- </record>
- <menuitem name="Reporting/Productivity Analysis/Definition/Available Models" id="menu_action_pa_models_form" action="action_productivity_analysis_models_form"/>
- </data>
-</terp>
diff --git a/addons/productivity_analysis/productivity_analysis_wizard.xml b/addons/productivity_analysis/productivity_analysis_wizard.xml
deleted file mode 100644
index 00da18f2ce3..00000000000
--- a/addons/productivity_analysis/productivity_analysis_wizard.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
-
- <wizard
- string="Productivity Analysis"
- model="productivity_analysis.models"
- name="productivity_analysis.models.print"
- menu="False"
- id="wizard_productivity_analysis_print"/>
- <menuitem
- name="Reporting/Productivity Analysis/Productivity Analysis"
- action="wizard_productivity_analysis_print"
- type="wizard"
- id="menu_productivity_analysis_print"/>
-
- </data>
-</terp>
diff --git a/addons/productivity_analysis/report/__init__.py b/addons/productivity_analysis/report/__init__.py
deleted file mode 100644
index 7435cf3a7e1..00000000000
--- a/addons/productivity_analysis/report/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import productivity_analysis
-
diff --git a/addons/productivity_analysis/report/productivity_analysis.py b/addons/productivity_analysis/report/productivity_analysis.py
deleted file mode 100644
index 0e5de7e764d..00000000000
--- a/addons/productivity_analysis/report/productivity_analysis.py
+++ /dev/null
@@ -1,150 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from report.render import render
-from report.interface import report_int
-from pychart import *
-from mx.DateTime import *
-from report.misc import choice_colors
-import time, mx
-import random
-import StringIO
-
-
-theme.use_color = 1
-#theme.scale = 2
-random.seed(0)
-
-class external_pdf(render):
- def __init__(self, pdf):
- render.__init__(self)
- self.pdf = pdf
- self.output_type='pdf'
-
- def _render(self):
- return self.pdf
-
-class report_custom(report_int):
- def _compute_dates(self, time_unit, start, stop=False):
- if not stop:
- stop = start
- dates = {}
- if time_unit == 'month':
- a = Date(*map(int, start.split("-"))).year*12+Date(*map(int, start.split("-"))).month
- z = Date(*map(int, stop.split("-"))).year*12+Date(*map(int, stop.split("-"))).month+1
- for i in range(a,z):
- year = i/12
- month = i%12
- if month == 0:
- year -= 1
- month = 12
- months = { 1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December" }
- dates[i] = {
- 'name' :months[month],
- 'start':(Date(year, month, 2) + RelativeDateTime(day=1)).strftime('%Y-%m-%d'),
- 'stop' :(Date(year, month, 2) + RelativeDateTime(day=-1)).strftime('%Y-%m-%d'),
- }
- return dates
- elif time_unit == 'week':
- a = Date(*map(int, start.split("-"))).iso_week[0]*52+Date(*map(int, start.split("-"))).iso_week[1]
- z = Date(*map(int, stop.split("-"))).iso_week[0]*52+Date(*map(int, stop.split("-"))).iso_week[1]
- for i in range(a,z+1):
- year = i/52
- week = i%52
- dates[i] = {
- 'name' :"Week #%d" % week,
- 'start':ISO.WeekTime(year, week, 1).strftime('%Y-%m-%d'),
- 'stop' :ISO.WeekTime(year, week, 7).strftime('%Y-%m-%d'),
- }
- return dates
- else: # time_unit = day
- a = Date(*map(int, start.split("-")))
- z = Date(*map(int, stop.split("-")))
- i = a
- while i <= z:
- dates[map(int,i.strftime('%Y%m%d').split())[0]] = {
- 'name' :i.strftime('%Y-%m-%d'),
- 'start':i.strftime('%Y-%m-%d'),
- 'stop' :i.strftime('%Y-%m-%d'),
- }
- i = i + RelativeDateTime(days=+1)
- return dates
- return {}
-
- def create(self, cr, uid, ids, datas, context={}):
- datas = datas['form']
- if datas['users_id']:
- datas['users_id'] = datas['users_id'][0][2]
- else:
- cr.execute('select id from res_users limit 10')
- datas['users_id'] = [x[0] for x in cr.fetchall()]
- cr.execute('select id,name from res_users where id in ('+','.join(map(str,datas['users_id']))+')')
- users_name = dict(cr.fetchall())
- colors = choice_colors(len(datas['users_id']))
- dates = self._compute_dates(datas['type'], datas['date1'], datas['date2'])
- dates_list = dates.keys()
- dates_list.sort()
- x_index = map(lambda x: (dates[x]['name'],x), dates_list)
- pdf_string = StringIO.StringIO()
- can = canvas.init(fname=pdf_string, format='pdf')
- chart_object.set_defaults(line_plot.T, line_style=None)
- y_label = 'Number of Objects'
-
- ar = area.T(legend = legend.T(),
- x_grid_style= line_style.gray70_dash1,
- x_axis = axis.X(label=None, format="/a90/hC%s"),
- x_coord = category_coord.T(x_index, 0),
- y_axis = axis.Y(label=y_label),
- y_range = (0, None), size = (680,450))
- bar_plot.fill_styles.reset();
-
- data = []
- for date in dates_list:
- cr.execute(("SELECT create_uid,count(*) FROM %s WHERE (substring(create_date,0,11) BETWEEN '%s' AND '%s') and id in ("+','.join(map(str,datas['users_id']))+") GROUP BY create_uid") % (datas['model'].replace('.','_'), dates[date]['start'], dates[date]['stop']))
- res = dict(cr.fetchall())
-
- vals = [dates[date]['name']]
- for user in datas['users_id']:
- vals.append(res.get(user, 0.0))
- data.append(vals)
-
- for user_id in range(len(datas['users_id'])):
- user = datas['users_id'][user_id]
-
- f = fill_style.Plain()
- f.bgcolor = colors[user_id]
- ar.add_plot(bar_plot.T(label=users_name.get(user,'Unknown').replace('/', '//'), data=data, hcol=user_id+1, cluster=(user_id, len(datas['users_id'])), fill_style=f ))
-
- ar.draw(can)
- can.close()
- self.obj = external_pdf(pdf_string.getvalue())
- self.obj.render()
- pdf_string.close()
- return (self.obj.pdf, 'pdf')
-report_custom('report.productivity_analysis.report')
-
diff --git a/addons/productivity_analysis/wizard/__init__.py b/addons/productivity_analysis/wizard/__init__.py
deleted file mode 100644
index eee68221a1b..00000000000
--- a/addons/productivity_analysis/wizard/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard_pa_report
-
diff --git a/addons/productivity_analysis/wizard/wizard_pa_report.py b/addons/productivity_analysis/wizard/wizard_pa_report.py
deleted file mode 100644
index f81e07c74c6..00000000000
--- a/addons/productivity_analysis/wizard/wizard_pa_report.py
+++ /dev/null
@@ -1,63 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-import wizard
-
-pa_form = '''<?xml version="1.0"?>
-<form string="Select period">
- <field name="date1"/>
- <field name="date2"/>
- <field name="model"/>
- <field name="type"/>
- <field name="type2"/>
- <field name="users_id" colspan="3"/>
-</form>'''
-
-pa_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
- 'users_id': {'string':'Users', 'type':'many2many', 'relation':'res.users', 'required':True},
- 'model': {'string':'Object', 'type':'selection', 'selection':[('res.partner','Partners'),('sale.order', 'Sale Order'),('account.invoice','Invoices')], 'required':True},
- 'type': {'string':'Period', 'type':'selection', 'selection':[('month', 'Month'),('week','Week'),('day','Day')], 'required':True, 'default': lambda *a: 'create'},
- 'type2': {'string':'Analysis Value', 'type':'selection', 'selection':[('create', 'Creations'),('update','Modifications')], 'required':True},
-}
-
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':pa_form, 'fields':pa_fields, 'state':[('end','Cancel'),('report','Print Analysis') ]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'productivity_analysis.report', 'state':'end'}
- }
- }
-wizard_report('productivity_analysis.models.print')
-
-
diff --git a/addons/purchase_discount/__init__.py b/addons/purchase_discount/__init__.py
deleted file mode 100644
index f2902ed0108..00000000000
--- a/addons/purchase_discount/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-import purchase_discount
-import report
diff --git a/addons/purchase_discount/__terp__.py b/addons/purchase_discount/__terp__.py
deleted file mode 100644
index 8be12f08e23..00000000000
--- a/addons/purchase_discount/__terp__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name" : "Purchase Order Lines With Discounts",
- "author" : "Tiny",
- "version" : "1.0",
- "category" : "Generic Modules/Sales & Purchases",
- "depends" : ["base", "account", "stock"],
- "demo_xml" : [],
- "update_xml" : ["purchase_discount_view.xml", "purchase_discount_report.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/purchase_discount/purchase_discount.py b/addons/purchase_discount/purchase_discount.py
deleted file mode 100644
index b9662cfe61c..00000000000
--- a/addons/purchase_discount/purchase_discount.py
+++ /dev/null
@@ -1,94 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields
-from osv import osv
-import time
-import netsvc
-
-import ir
-from mx import DateTime
-import pooler
-
-class purchase_order_line(osv.osv):
- _name = "purchase.order.line"
- _inherit = "purchase.order.line"
-
- def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for line in self.browse(cr, uid, ids):
- cur = line.order_id.pricelist_id.currency_id
- res[line.id] = cur_obj.round(cr, uid, cur, line.price_unit * line.product_qty * (1 - (line.discount or 0.0) /100.0))
- return res
-
- _columns = {
- 'discount': fields.float('Discount (%)', digits=(16,2)),
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
- }
- _defaults = {
- 'discount': lambda *a: 0.0,
- }
-purchase_order_line()
-
-class purchase_order(osv.osv):
- _name = "purchase.order"
- _inherit = "purchase.order"
-
- def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
- id_set = ",".join(map(str, ids))
- sql_req="SELECT s.id,COALESCE(SUM(l.price_unit*l.product_qty*(100.0-l.discount))/100.0,0) AS amount FROM purchase_order s LEFT OUTER JOIN purchase_order_line l ON (s.id=l.order_id) WHERE s.id IN ("+id_set+") GROUP BY s.id"
- cr.execute(sql_req)
-
- res = dict(cr.fetchall())
-
- cur_obj=self.pool.get('res.currency')
- for id in res.keys():
- order=self.browse(cr, uid, [id])[0]
- cur=order.pricelist_id.currency_id
- res[id]=cur_obj.round(cr, uid, cur, res[id])
- return res
-
-
- def _amount_tax(self, cr, uid, ids, field_name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for order in self.browse(cr, uid, ids):
- val = 0.0
- cur=order.pricelist_id.currency_id
- for line in order.order_line:
- for c in self.pool.get('account.tax').compute(cr, uid, line.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_qty, order.partner_address_id.id, line.product_id):
- val+= cur_obj.round(cr, uid, cur, c['amount'])
- res[order.id]=cur_obj.round(cr, uid, cur, val)
- return res
-
- _columns = {
- 'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
- 'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
- }
-
-purchase_order()
diff --git a/addons/purchase_discount/purchase_discount_report.xml b/addons/purchase_discount/purchase_discount_report.xml
deleted file mode 100644
index 16d44d03e03..00000000000
--- a/addons/purchase_discount/purchase_discount_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report id="purchase.report_purchase_order"
- name="purchase.discount.order"
- string="Print Orders"
- model="purchase.order"
- rml="purchase_discount/report/order.rml"
- auto="False"/>
- </data>
-</terp>
diff --git a/addons/purchase_discount/purchase_discount_view.xml b/addons/purchase_discount/purchase_discount_view.xml
deleted file mode 100644
index ecd9449137a..00000000000
--- a/addons/purchase_discount/purchase_discount_view.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<terp>
-<data>
- <record model="ir.ui.view" id="purchase_discount_order_line_form">
- <field name="name">purchase_discount.order.line.form</field>
- <field name="model">purchase.order.line</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
- <field name="arch" type="xml">
- <field name="price_unit" position="after">
- <field name="discount"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="purchase_discount_order_line_tree">
- <field name="name">purchase_discount.order.line.tree</field>
- <field name="model">purchase.order.line</field>
- <field name="type">tree</field>
- <field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
- <field name="arch" type="xml">
- <field name="price_unit" position="after">
- <field name="discount"/>
- </field>
- </field>
- </record>
-
-</data>
-</terp> \ No newline at end of file
diff --git a/addons/purchase_discount/report/__init__.py b/addons/purchase_discount/report/__init__.py
deleted file mode 100644
index af013832d7c..00000000000
--- a/addons/purchase_discount/report/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import order
-
diff --git a/addons/purchase_discount/report/order.py b/addons/purchase_discount/report/order.py
deleted file mode 100644
index 64b525fcc7b..00000000000
--- a/addons/purchase_discount/report/order.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-from report import report_sxw
-from osv import osv
-import pooler
-
-class order(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- print "foo"
- super(order, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'get_line_tax': self._get_line_tax,
- 'get_tax': self._get_tax,
- 'get_product_code': self._get_product_code,
- })
- def _get_line_tax(self, line_obj):
- self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%d" % (line_obj.id))
- res = self.cr.fetchall() or None
- if not res:
- return ""
- if isinstance(res, list):
- tax_ids = [t[0] for t in res]
- else:
- tax_ids = res[0]
- res = [tax.name for tax in pooler.get_pool(cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)]
- return ",\n ".join(res)
-
- def _get_tax(self, order_obj):
- self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \
- WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%d)" % (order_obj.id))
- res = self.cr.fetchall() or None
- if not res:
- return []
- if isinstance(res, list):
- tax_ids = [t[0] for t in res]
- else:
- tax_ids = res[0]
- tax_obj = pooler.get_pool(cr.dbname).get('account.tax')
- res = []
- for tax in tax_obj.browse(self.cr, self.uid, tax_ids):
- self.cr.execute("SELECT DISTINCT order_line_id FROM purchase_order_line, purchase_order_taxe \
- WHERE (purchase_order_taxe.tax_id=%d) AND (purchase_order_line.order_id=%d)" % (tax.id, order_obj.id))
- lines = self.cr.fetchall() or None
- if lines:
- if isinstance(lines, list):
- line_ids = [l[0] for l in lines]
- else:
- line_ids = lines[0]
- base = 0
- for line in pooler.get_pool(cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids):
- base += line.price_subtotal
- res.append({'code':tax.name,
- 'base':base,
- 'amount':base*tax.amount})
- return res
- def _get_product_code(self, product_id, partner_id):
- product_obj=pooler.get_pool(self.cr.dbname).get('product.product')
- return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id]
-
-report_sxw.report_sxw('report.purchase.discount.order','purchase.order','addons/purchase_discount/report/order.rml',parser=order)
diff --git a/addons/purchase_discount/report/order.rml b/addons/purchase_discount/report/order.rml
deleted file mode 100644
index b7a2a0615b8..00000000000
--- a/addons/purchase_discount/report/order.rml
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf"><template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"><pageTemplate id="first"><frame id="first" x1="42.0" y1="42.0" width="511" height="758"/></pageTemplate></template><stylesheet><blockTableStyle id="Standard_Outline"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau6"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau10"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau2"><blockAlignment value="LEFT"/><blockValign value="TOP"/><lineStyle kind="GRID" colorName="black"/><blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/><blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/><blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/><blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/><blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/><blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/><blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/><blockBackground colorName="#e6e6e6" start="7,0" stop="7,0"/></blockTableStyle><blockTableStyle id="Tableau3"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau5"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau1"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau4"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><initialize><paraStyle name="all" alignment="justify"/></initialize><paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11"/><paraStyle name="P2" fontName="Times-Roman"/><paraStyle name="P3" fontName="Times-Roman" alignment="LEFT"/><paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13"/><paraStyle name="P5" fontName="Times-Roman" fontSize="10.0" leading="13"/><paraStyle name="P6" fontName="Times-Roman" fontSize="10.0" leading="13"/><paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13"/><paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14"/><paraStyle name="P9" fontName="Times-Roman" fontSize="4.0" leading="5"/><paraStyle name="P10" fontName="Times-Roman" fontSize="16.0" leading="20"/><paraStyle name="P11" fontName="Times-Bold" fontSize="8.0" leading="10"/><paraStyle name="P12" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/><paraStyle name="P13" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/><paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P15" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/><paraStyle name="P16" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P17" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P18" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P19" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P20" fontName="Times-Bold" fontSize="9.0" leading="11"/><paraStyle name="P21" fontName="Times-Roman" fontSize="7.0" leading="9"/><paraStyle name="P22" fontName="Times-Roman" fontSize="9.0" leading="11"/><paraStyle name="P23" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P24" fontName="Times-Roman" fontSize="7.0" leading="9"/><paraStyle name="P25" fontName="Times-Roman" fontSize="11.0" leading="14"/><paraStyle name="Standard" fontName="Times-Roman"/><paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/><paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/><paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/><paraStyle name="Table Contents" fontName="Times-Roman"/><paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/><paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/><paraStyle name="Index" fontName="Times-Roman"/></stylesheet><images/><story><para style="P1">[[ repeatIn(objects,'o') ]]</para><para style="P1"><font color="white"> </font></para><blockTable colWidths="241.0,57.0,213.0" style="Tableau6"><tr><td><blockTable colWidths="241.0" style="Tableau10"><tr><td><para style="P4">Shipping address :</para></td></tr><tr><td><para style="P5">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para><para style="P6">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para><para style="P6">[[ addr.title or '' ]] [[ addr.name ]]</para><para style="P6">[[ addr.street ]]</para><para style="P6">[[ addr.street2 or '' ]]</para><para style="P7"><font face="Times-Roman">[[ addr.zip or '' ]]</font> [[ addr.city or '' ]]</para><para style="P7">[[ addr.state_id and addr.state_id.name or '' ]]</para><para style="P7">[[ addr.country_id and addr.country_id.name or '' ]]</para></td></tr></blockTable><para style="P22"><font color="white"> </font></para></td><td><para style="P22"><font color="white"> </font></para></td><td><para style="P8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para><para style="P8">[[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]]</para><para style="P8">[[ o.partner_address_id.street ]]</para><para style="P8">[[ o.partner_address_id.street2 or '' ]]</para><para style="P8">[[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]]</para><para style="P8">[[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]</para><para style="P8">[[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]]</para><para style="P9"><font color="white"> </font></para><para style="P6">T&#xE9;l.&#xA0;: [[ o.partner_address_id.phone or '' ]]</para><para style="P6">Fax&#xA0;: [[ o.partner_address_id.fax or '' ]]</para><para style="P6">TVA&#xA0;: [[ o.partner_id.vat or '' ]]</para></td></tr></blockTable><para style="P2"><font color="white"> </font></para><para style="P10">[[ o.state=='draft' and 'Quotation ' or 'Order ' ]] N&#xB0; : [[ o.name ]]</para><para style="P10"><font color="white"> </font></para><para style="P25">Our order reference : [[ o.ref or '' ]]</para><para style="P25">Your order reference : [[ o.partner_ref or '' ]]</para><para style="P25">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para><para style="P25">Validated by : [[ o.validator and o.validator.name or '' ]]</para><para style="P2"><font color="white"> </font></para><blockTable colWidths="195.0,51.0,46.0,45.0,31.0,56.0,43.0,43.0" repeatRows="1" style="Tableau2"><tr><td><para style="P11">Product Description</para></td><td><para style="P12">Applicable Taxes</para></td><td><para style="P12">Date Promised</para></td><td><para style="P12">Qty</para></td><td><para style="P12">UoM</para></td><td><para style="P12">Unit Price</para></td><td><para style="P12">Discount (%)</para></td><td><para style="P12">Net Price</para></td></tr></blockTable><section><para style="P13">[[ repeatIn(o.order_line,'line') ]]</para><blockTable colWidths="195.0,51.0,46.0,45.0,31.0,56.0,43.0,43.0" style="Tableau3"><tr><td><para style="P14">[[ line.name ]]</para></td><td><para style="P15">[[ ', '.join(map(lambda x: x.name, line.taxes_id))]]</para></td><td><para style="P15">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para></td><td><para style="P16">[[ line.product_qty ]]</para></td><td><para style="P14">[[ line.product_uom.name ]]</para></td><td><para style="P16">[[ '%.2f' % line.price_unit ]]</para></td><td><para style="P16">[[ '%.2f'%line.discount ]]</para></td><td><para style="P16">[[ '%.2f' % line.price_subtotal ]]</para></td></tr></blockTable><blockTable colWidths="43.0,333.0,135.0" style="Tableau5"><tr><td><para style="P17">[[ repeatIn((line.notes and [line.notes]) or [], 'l') ]]</para></td><td><para style="P18">[[ l or removeParentNode('table') ]]</para></td><td><para style="P17"><font color="white"> </font></para></td></tr></blockTable></section><para style="Standard"><font color="white"> </font></para><blockTable colWidths="376.0,65.0,69.0" style="Tableau1"><tr><td><para style="P24"><font color="white"> </font></para></td><td><para style="P23">Net Total&#xA0;:</para></td><td><para style="P23">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr><tr><td><para style="P24"><font color="white"> </font></para></td><td><para style="P23">Taxes&#xA0;:</para></td><td><para style="P23">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr><tr><td><para style="P21"><font color="white"> </font></para></td><td><para style="P19">TOTAL&#xA0;:</para></td><td><para style="P19">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr></blockTable><para style="P20"><font color="white"> </font></para><blockTable colWidths="510.0" style="Tableau4"><tr><td><para style="P3">[[ format(o.notes or '') ]]</para></td></tr></blockTable><para style="P3"><font color="white"> </font></para></story></document>
diff --git a/addons/purchase_journal/__init__.py b/addons/purchase_journal/__init__.py
deleted file mode 100644
index 8886aa9e20e..00000000000
--- a/addons/purchase_journal/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import purchase_journal
-import purchase_journal_inherit
-import purchase_journal_report
diff --git a/addons/purchase_journal/__terp__.py b/addons/purchase_journal/__terp__.py
deleted file mode 100644
index c09dbdad30d..00000000000
--- a/addons/purchase_journal/__terp__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Use the custom module to put your specific code in a separate module.
-#
-{
- "name" : "Managing sales and deliveries by journal",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Sales & Purchases",
- "website": "http://www.tinyerp.com",
- "depends" : ["stock","purchase"],
- "demo_xml" : ['purchase_journal_demo.xml'],
- "init_xml" : ['purchase_journal_data.xml'],
- "update_xml" : ["purchase_journal_view.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/purchase_journal/purchase_journal.py b/addons/purchase_journal/purchase_journal.py
deleted file mode 100644
index c5feed4f2f1..00000000000
--- a/addons/purchase_journal/purchase_journal.py
+++ /dev/null
@@ -1,82 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-import netsvc
-import time
-
-class purchase_journal(osv.osv):
- _name = 'purchase_journal.purchase.journal'
- _description = 'purchase Journal'
- _columns = {
- 'name': fields.char('Journal', size=64, required=True),
- 'code': fields.char('Code', size=16, required=True),
- 'user_id': fields.many2one('res.users', 'Responsible', required=True),
- 'date': fields.date('Journal date', required=True),
- 'date_created': fields.date('Creation date', readonly=True, required=True),
- 'date_validation': fields.date('Validation date', readonly=True),
- 'purchase_stats_ids': fields.one2many("purchase_journal.purchase.stats", "journal_id", 'purchase Stats', readonly=True),
- 'state': fields.selection([
- ('draft','Draft'),
- ('open','Open'),
- ('done','Done'),
- ], 'Creation date', required=True),
- 'note': fields.text('Note'),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- 'date_created': lambda *a: time.strftime('%Y-%m-%d'),
- 'user_id': lambda self,cr,uid,context: uid,
- 'state': lambda self,cr,uid,context: 'draft',
- }
- def button_purchase_cancel(self, cr, uid, ids, context={}):
- for id in ids:
- purchase_ids = self.pool.get('purchase.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
- for purchaseid in purchase_ids:
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'purchase.order', purchaseid, 'cancel', cr)
- return True
- def button_purchase_confirm(self, cr, uid, ids, context={}):
- for id in ids:
- purchase_ids = self.pool.get('purchase.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
- for purchaseid in purchase_ids:
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'purchase.order', purchaseid, 'order_confirm', cr)
- return True
-
- def button_open(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'open'})
- return True
- def button_draft(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'draft'})
- return True
- def button_close(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'done', 'date_validation':time.strftime('%Y-%m-%d')})
- return True
-purchase_journal()
-
diff --git a/addons/purchase_journal/purchase_journal_data.xml b/addons/purchase_journal/purchase_journal_data.xml
deleted file mode 100644
index f60494d5328..00000000000
--- a/addons/purchase_journal/purchase_journal_data.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
-
-</data>
-</terp>
diff --git a/addons/purchase_journal/purchase_journal_demo.xml b/addons/purchase_journal/purchase_journal_demo.xml
deleted file mode 100644
index 98793851804..00000000000
--- a/addons/purchase_journal/purchase_journal_demo.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
-</data>
-</terp>
diff --git a/addons/purchase_journal/purchase_journal_inherit.py b/addons/purchase_journal/purchase_journal_inherit.py
deleted file mode 100644
index 80a1717cb46..00000000000
--- a/addons/purchase_journal/purchase_journal_inherit.py
+++ /dev/null
@@ -1,52 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-
-
-class purchase(osv.osv):
- _inherit="purchase.order"
- _columns = {
- 'journal_id': fields.many2one('purchase_journal.purchase.journal', 'Journal'),
- }
- def action_picking_create(self, cr, uid, ids, *args):
- result = super(purchase, self).action_picking_create(cr, uid, ids, *args)
- for order in self.browse(cr, uid, ids, context={}):
- pids = [ x.id for x in (order.picking_ids or [])]
- self.pool.get('stock.picking').write(cr, uid, pids, {
- 'purchase_journal_id': order.journal_id.id
- })
- return result
-purchase()
-
-class picking(osv.osv):
- _inherit="stock.picking"
- _columns = {
- 'purchase_journal_id': fields.many2one('purchase_journal.purchase.journal', 'Purchase Journal', select=True),
- }
-picking()
diff --git a/addons/purchase_journal/purchase_journal_report.py b/addons/purchase_journal/purchase_journal_report.py
deleted file mode 100644
index 501d7abc708..00000000000
--- a/addons/purchase_journal/purchase_journal_report.py
+++ /dev/null
@@ -1,73 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: purchase.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class report_purchase_journal_purchase(osv.osv):
- _name = "purchase_journal.purchase.stats"
- _description = "Purchases Orders by Journal"
- _auto = False
- _columns = {
- 'name': fields.date('Month', readonly=True),
- 'state': fields.selection([
- ('draft', 'Request for Quotation'),
- ('wait', 'Waiting'),
- ('confirmed', 'Confirmed'),
- ('approved', 'Approved'),
- ('except_ship', 'Shipping Exception'),
- ('except_invoice', 'Invoice Exception'),
- ('done', 'Done'), ('cancel', 'Cancelled')], 'Order State', readonly=True,
- select=True),
- 'journal_id':fields.many2one('purchase_journal.purchase.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- }
- _order = 'journal_id,name desc,price_total desc'
- def init(self, cr):
- cr.execute("""
- create or replace view purchase_journal_purchase_stats as (
- select
- min(l.id) as id,
- substring(s.date_order for 7)||'-'||'01' as name,
- s.state,
- s.journal_id,
- sum(l.product_qty) as quantity,
- count(*),
- sum(l.product_qty*l.price_unit) as price_total,
- (sum(l.product_qty*l.price_unit)/sum(l.product_qty))::decimal(16,2) as price_average
- from purchase_order s
- right join purchase_order_line l on (s.id=l.order_id)
- group by s.journal_id, substring(s.date_order for 7),s.state
- )
- """)
-report_purchase_journal_purchase()
-
-
diff --git a/addons/purchase_journal/purchase_journal_view.xml b/addons/purchase_journal/purchase_journal_view.xml
deleted file mode 100644
index 2cbc11e2b01..00000000000
--- a/addons/purchase_journal/purchase_journal_view.xml
+++ /dev/null
@@ -1,242 +0,0 @@
-<terp>
-<data>
- <record model="ir.ui.view" id="purchase_journal_picking_order">
- <field name="name">stock.picking.journal.view.form</field>
- <field name="type">form</field>
- <field name="model">stock.picking</field>
- <field name="inherit_id" ref="stock.view_picking_form" />
- <field name="arch" type="xml">
- <field name="origin" position="after">
- <field name="purchase_journal_id" select="1" readonly="1"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="purchase_journal_picking_order_tree">
- <field name="name">stock.picking.purchase.journal.view.tree</field>
- <field name="type">tree</field>
- <field name="model">stock.picking</field>
- <field name="inherit_id" ref="stock.vpicktree" />
- <field name="arch" type="xml">
- <field name="invoice_state" position="after">
- <field name="purchase_journal_id"/>
- </field>
- </field>
- </record>
-
-
- <record model="ir.ui.view" id="view_purchase_journal_form">
- <field name="name">purchase_journal.purchase.journal.form</field>
- <field name="model">purchase_journal.purchase.journal</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="purchase Journal">
- <notebook>
- <page string="Journal">
- <separator string="Journal Information" colspan="4"/>
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="date_created" select="1"/>
- <field name="date_validation" select="1"/>
- <separator string="States" colspan="4"/>
- <field name="state"/>
- <group col="3" colspan="2">
- <button name="button_open" string="Open Journal" states="draft" type="object"/>
- <button name="button_close" string="Close Journal" states="open" type="object"/>
- <button name="button_draft" string="Set to Draft" states="close,open" type="object"/>
- </group>
- </page>
- <page string="purchases">
- <button string="Confirm purchases" name="button_purchase_confirm" states="draft,open" type="object"/>
- <button string="Cancel purchases" name="button_purchase_cancel" states="draft,open" type="object"/>
- <newline/>
- <field name="purchase_stats_ids" colspan="4" nolabel="1">
- <tree string="purchases">
- <field name="name"/>
- <field name="quantity"/>
- <field name="price_total"/>
- <field name="price_average"/>
- <field name="count"/>
- <field name="state"/>
- </tree>
- </field>
- </page><page string="Notes">
- <field name="note" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_purchase_journal_tree">
- <field name="name">purchase_journal.purchase.journal.tree</field>
- <field name="model">purchase_journal.purchase.journal</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="purchase Journal">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_definition_journal">
- <field name="res_model">purchase_journal.purchase.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Purchase Management/Configuration/Purchases Journals"
- id="menu_definition_journal"
- action="action_definition_journal"/>
-
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree">
- <field name="res_model">purchase_journal.purchase.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[]</field>
- </record>
- <menuitem
- name="Purchase Management/Purchases by Journal"
- id="menu_definition_journal_purchases"
- action="action_definition_journal_tree"/>
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree_my">
- <field name="name">My Open Journals</field>
- <field name="res_model">purchase_journal.purchase.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('user_id','=',uid),('state','=','open')]</field>
- </record>
- <menuitem
- name="Purchase Management/Purchases by Journal/"
- id="menu_definition_journal_purchases_my_open"
- action="action_definition_journal_tree_my"/>
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree_all">
- <field name="name">Open journals</field>
- <field name="res_model">purchase_journal.purchase.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','open')]</field>
- </record>
- <menuitem
- name="Purchase Management/Purchases by Journal/All Open Journals"
- id="menu_definition_journal_purchases_all_open"
- action="action_definition_journal_tree_all"/>
-
-
- <record model="ir.ui.view" id="purchase_journal_purchase_order">
- <field name="name">purchase.order.journal.view.form</field>
- <field name="type">form</field>
- <field name="model">purchase.order</field>
- <field name="inherit_id" ref="purchase.purchase_order_form" />
- <field name="arch" type="xml">
- <field name="date_approve" position="after">
- <field name="journal_id" select="1"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="purchase_journal_purchase_order_tree">
- <field name="name">purchase.order.journal.view.tree</field>
- <field name="type">tree</field>
- <field name="model">purchase.order</field>
- <field name="inherit_id" ref="purchase.purchase_order_tree" />
- <field name="arch" type="xml">
- <field name="state" position="after">
- <field name="journal_id"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_purchase_journal_purchase_stats_tree">
- <field name="name">purchase_journal.purchase.stats.tree</field>
- <field name="model">purchase_journal.purchase.stats</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="purchases by Journal">
- <field name="name"/>
- <field name="state"/>
- <field name="journal_id"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_purchase_journal_purchase_stats_form">
- <field name="name">purchase_journal.purchase.stats.form</field>
- <field name="model">purchase_journal.purchase.stats</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="purchases by Journal">
- <field name="name" select="1"/>
- <field name="state" select="1"/>
- <field name="journal_id" select="1"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_purchase_purchase_stats_open_menu_month">
- <field name="name">Purchase by journal (this month)</field>
- <field name="res_model">purchase_journal.purchase.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
- </record>
- <menuitem
- name="Purchase Management/Reporting/This Month/Purchases by Journal"
- action="action_purchase_purchase_stats_open_menu_month"
- id="menu_purchase_purchase_stats_open_menu"/>
-
- <record model="ir.actions.act_window" id="action_purchase_purchase_stats_open_menu_all">
- <field name="res_model">purchase_journal.purchase.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Purchase Management/Reporting/All Months/Purchases by Journal"
- action="action_purchase_purchase_stats_open_menu_all"
- id="menu_purchase_purchase_stats_open_all"/>
-
- <act_window name="Draft purchases"
- domain="[('journal_id', '=', active_id),('state', '=', 'draft')]"
- res_model="purchase.order"
- src_model="purchase_journal.purchase.journal"
- id="act_purchase_journal_purchase_journal_2_purchase_order_draft"/>
-
- <act_window name="Approved purchases"
- domain="[('journal_id', '=', active_id),('state', '=', 'approved')]"
- res_model="purchase.order"
- src_model="purchase_journal.purchase.journal"
- id="act_purchase_journal_purchase_journal_2_purchase_order_approved"/>
-
- <act_window name="Assigned packings"
- domain="[('purchase_journal_id', '=', active_id),('state', '=', 'assigned')]"
- res_model="stock.picking"
- src_model="purchase_journal.purchase.journal"
- id="act_purchase_journal_purchase_journal_2_stock_picking_assigned"/>
-
- <act_window name="Confirmed packings"
- domain="[('purchase_journal_id', '=', active_id),('state', '=', 'confirmed')]"
- res_model="stock.picking"
- src_model="purchase_journal.purchase.journal"
- id="act_purchase_journal_purchase_journal_2_stock_picking_confirmed"/>
-
- <act_window name="Monthly purchases"
- domain="[('journal_id', '=', active_id)]"
- res_model="purchase_journal.purchase.stats"
- src_model="purchase_journal.purchase.journal"
- id="act_purchase_journal_purchase_journal_2_purchase_journal_purchase_stats"/>
-</data>
-</terp>
diff --git a/addons/purchase_tax_include/__init__.py b/addons/purchase_tax_include/__init__.py
deleted file mode 100644
index 72873c58aa9..00000000000
--- a/addons/purchase_tax_include/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import purchase_tax_incl
diff --git a/addons/purchase_tax_include/__terp__.py b/addons/purchase_tax_include/__terp__.py
deleted file mode 100644
index 0d43938bed0..00000000000
--- a/addons/purchase_tax_include/__terp__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name" : "Purchases with taxes included",
- "version" : "1.0",
- "depends" : ["purchase","account_tax_include"],
- "author" : "Tiny",
- "website" : "http://tinyerp.com/module_account.html",
- "category" : "Generic Modules/Sales & Purchases",
- "description": "This module allows you to use purchase order with prices including or excluding taxes.",
- "init_xml" : [ ],
- "demo_xml" : [ ],
- "update_xml" : [ 'purchase_tax_incl.xml' ],
- "active": False,
- "installable": True
-}
diff --git a/addons/purchase_tax_include/purchase_tax_incl.py b/addons/purchase_tax_include/purchase_tax_incl.py
deleted file mode 100644
index dc30cf530ad..00000000000
--- a/addons/purchase_tax_include/purchase_tax_incl.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-import netsvc
-from osv import fields, osv
-import ir
-
-class purchase_order(osv.osv):
- _inherit = "purchase.order"
- def _amount_tax(self, cr, uid, ids, field_name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for order in self.browse(cr, uid, ids):
- val = 0.0
- cur=order.pricelist_id.currency_id
- for line in order.order_line:
- if order.price_type=='tax_included':
- ttt = self.pool.get('account.tax').compute_inv(cr, uid, line.taxes_id, line.price_unit, line.product_qty, order.partner_address_id.id, line.product_id, order.partner_id)
- else:
- ttt = self.pool.get('account.tax').compute(cr, uid, line.taxes_id, line.price_unit, line.product_qty, order.partner_address_id.id, line.product_id, order.partner_id)
- for c in ttt:
- val += cur_obj.round(cr, uid, cur, c['amount'])
- res[order.id]=cur_obj.round(cr, uid, cur, val)
- return res
- _columns = {
- 'price_type': fields.selection([
- ('tax_included','Tax included'),
- ('tax_excluded','Tax excluded')
- ], 'Price method', required=True),
- 'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
- }
- _defaults = {
- 'price_type': lambda *a: 'tax_excluded',
- }
- def _inv_get(self, cr, uid, order, context={}):
- return {
- 'price_type': order.price_type
- }
-purchase_order()
-
-class purchase_order_line(osv.osv):
- _inherit = 'purchase.order.line'
- def _amount_line(self, cr, uid, ids, name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- tax_obj = self.pool.get('account.tax')
- res = super(purchase_order_line, self)._amount_line(cr, uid, ids, name, arg, context)
- res2 = res.copy()
- for line in self.browse(cr, uid, ids):
- if line.order_id.price_type == 'tax_included':
- if line.product_id:
- for tax in tax_obj.compute_inv(cr, uid, line.product_id.supplier_taxes_id, res[line.id]/line.product_qty, line.product_qty):
- res[line.id] = res[line.id] - tax['amount']
- else:
- for tax in tax_obj.compute_inv(cr, uid, line.taxes_id, res[line.id]/line.product_qty, line.product_qty):
- res[line.id] = res[line.id] - tax['amount']
- if name == 'price_subtotal_incl' and line.order_id.price_type == 'tax_included':
- if line.product_id:
- prod_taxe_ids = [ t.id for t in line.product_id.supplier_taxes_id ]
- prod_taxe_ids.sort()
- line_taxe_ids = [ t.id for t in line.taxes_id ]
- line_taxe_ids.sort()
- if line.product_id and prod_taxe_ids == line_taxe_ids:
- res[line.id] = res2[line.id]
- elif not line.product_id:
- res[line.id] = res2[line.id]
- else:
- for tax in tax_obj.compute(cr, uid, line.taxes_id, res[line.id]/line.product_qty, line.product_qty):
- res[line.id] = res[line.id] + tax['amount']
- cur = line.order_id.pricelist_id.currency_id
- res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
- return res
- _columns = {
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal w/o tax'),
- 'price_subtotal_incl': fields.function(_amount_line, method=True, string='Subtotal'),
- }
-purchase_order_line()
diff --git a/addons/purchase_tax_include/purchase_tax_incl.xml b/addons/purchase_tax_include/purchase_tax_incl.xml
deleted file mode 100644
index 1d698439f4d..00000000000
--- a/addons/purchase_tax_include/purchase_tax_incl.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <record model="ir.ui.view" id="account_tax_view_price">
- <field name="name">purchase.order.exlcuded.view.form</field>
- <field name="type">form</field>
- <field name="model">purchase.order</field>
- <field name="inherit_id" ref="purchase.purchase_order_form" />
- <field name="arch" type="xml">
- <field name="origin" position="after">
- <field name="price_type"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="account_tax_view_price_subtotal_incl">
- <field name="name">purchase.order.line.tree</field>
- <field name="type">tree</field>
- <field name="model">purchase.order.line</field>
- <field name="inherit_id" ref="purchase.purchase_order_line_tree" />
- <field name="arch" type="xml">
- <field name="price_subtotal" position="after">
- <field name="price_subtotal_incl"/>
- </field>
- </field>
- </record>
-
-</data>
-</terp>
-
diff --git a/addons/sale_category/__init__.py b/addons/sale_category/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/sale_category/__init__.py
+++ /dev/null
diff --git a/addons/sale_category/__terp__.py b/addons/sale_category/__terp__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/sale_category/__terp__.py
+++ /dev/null
diff --git a/addons/sale_category/report/__init__.py b/addons/sale_category/report/__init__.py
deleted file mode 100644
index d4a1c2654b4..00000000000
--- a/addons/sale_category/report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import sale_category_report
diff --git a/addons/sale_category/report/sale_category_report.py b/addons/sale_category/report/sale_category_report.py
deleted file mode 100644
index dadc81f4e87..00000000000
--- a/addons/sale_category/report/sale_category_report.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import pooler
-import time
-from report import report_sxw
-
-class sale_category_report(report_sxw.rml_parse):
- # o must be an instance of sale_order. Returns a list of 2-tuple
- # (category name, [list of sale_order_line of this category])
- def order_lines_by_categ(self, o):
- # result is a dictionnary where keys are category
- # names and values are lists of sale_category_sale_order_line.
-
- self.pool = pooler.get_pool(self.cr.dbname)
- ids = self.pool.get('product.category').search(self.cr, self.uid, [('parent_id','=',False)])
- cats = map(lambda x: (x, (x.sequence,)), self.pool.get('product.category').browse(self.cr, self.uid, ids))
- pos = 0
- result = {}
- while pos<len(cats):
- for c2 in cats[pos][0].child_id[::-1]:
- cats.insert(pos+1, (c2, cats[pos][1]+(cats[pos][0].sequence,)))
- for line in o.order_line:
- if line.product_id.categ_id == cats[pos][0]:
- result.setdefault( (cats[pos][1], cats[pos][0].complete_name), []).append(line)
- pos += 1
- return sorted(result.items())
-
- def __init__(self, cr, uid, name, context):
- super(sale_category_report, self).__init__(cr, uid, name, context)
- self.localcontext.update( {
- 'time' : time,
- 'order_lines_by_categ' : self.order_lines_by_categ,
- } )
-
-report_sxw.report_sxw(
- 'report.sale_category.print',
- 'sale.order',
- 'addons/sale_category/report/sale_category_report.rml',
- parser=sale_category_report)
diff --git a/addons/sale_category/report/sale_category_report.rml b/addons/sale_category/report/sale_category_report.rml
deleted file mode 100644
index 4d11439ae4c..00000000000
--- a/addons/sale_category/report/sale_category_report.rml
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf"><template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"><pageTemplate id="first"><frame id="first" x1="34.0" y1="42.0" width="527" height="758"/></pageTemplate></template><stylesheet><blockTableStyle id="Standard_Outline"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau1"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau2"><blockAlignment value="LEFT"/><blockValign value="TOP"/><lineStyle kind="GRID" colorName="black"/><blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/><blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/><blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/><blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/><blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/><blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/><blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/></blockTableStyle><blockTableStyle id="Tableau3"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau8"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau9"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><blockTableStyle id="Tableau4"><blockAlignment value="LEFT"/><blockValign value="TOP"/></blockTableStyle><initialize><paraStyle name="all" alignment="justify"/></initialize><paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11"/><paraStyle name="P2" fontName="Times-Roman" fontSize="8.0" leading="10"/><paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/><paraStyle name="P4" fontName="Times-Roman" alignment="LEFT"/><paraStyle name="P5" fontName="Times-Roman" alignment="LEFT"/><paraStyle name="P6" fontName="Times-Bold" fontSize="9.0" leading="11"/><paraStyle name="P7" fontName="Times-Bold" fontSize="9.0" leading="11"/><paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/><paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P12" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P13" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P14" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/><paraStyle name="P15" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="P16" fontName="Times-Bold" fontSize="9.0" leading="11"/><paraStyle name="P17" fontName="Times-Roman" fontSize="10.0" leading="13"/><paraStyle name="P18" fontName="Times-Roman" fontSize="10.0" leading="13"/><paraStyle name="P19" fontName="Times-Roman" fontSize="4.0" leading="5"/><paraStyle name="P20" fontName="Times-Roman" fontSize="4.0" leading="5"/><paraStyle name="P21" fontName="Times-Roman" fontSize="11.0" leading="14"/><paraStyle name="P22" fontName="Times-Roman" fontSize="11.0" leading="14"/><paraStyle name="P23" fontName="Times-Roman" fontSize="16.0" leading="20"/><paraStyle name="P24" fontName="Times-Bold" fontSize="8.0" leading="10"/><paraStyle name="P25" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/><paraStyle name="P26" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/><paraStyle name="P27" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="LEFT"/><paraStyle name="P28" fontName="Times-Roman" fontSize="7.0" leading="9"/><paraStyle name="P29" fontName="Times-Roman" fontSize="11.0" leading="14"/><paraStyle name="P30" fontName="Times-Roman" fontSize="7.0" leading="9"/><paraStyle name="P31" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/><paraStyle name="Standard" fontName="Times-Roman"/><paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/><paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/><paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/><paraStyle name="Table Contents" fontName="Times-Roman"/><paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/><paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/><paraStyle name="Index" fontName="Times-Roman"/></stylesheet><images/><story><para style="P1">[[ repeatIn(objects,'o') ]] <font face="Times-Roman">[[ setLang(o.partner_id.lang) ]]</font></para><blockTable colWidths="257.0,50.0,220.0" style="Tableau1"><tr><td><para style="P6">Shipping address :</para><para style="P17">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para><para style="P17">[[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]]</para><para style="P17">[[ o.partner_shipping_id.street ]]</para><para style="P17">[[ o.partner_shipping_id.street2 or '' ]]</para><para style="P18"><font face="Times-Roman">[[ o.partner_shipping_id.zip or '' ]]</font> [[ o.partner_shipping_id.city or '' ]]</para><para style="P18">[[ o.partner_shipping_id.state_id and o.partner_shipping_id.state_id.name or '' ]]</para><para style="P18">[[ o.partner_shipping_id.country_id and o.partner_shipping_id.country_id.name or '' ]]</para><para style="P19"><font color="white"> </font></para><para style="P7">Invoice address :</para><para style="P18">[[ o.partner_invoice_id.street ]][[ o.partner_invoice_id.street2 and ', %s' % o.partner_invoice_id.street2 or '' ]]</para><para style="P18">[[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]] [[ ', %s' % (o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '') ]]</para></td><td><para style="P21"><font color="white"> </font></para></td><td><para style="P22">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para><para style="P22">[[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]]</para><para style="P22">[[ o.partner_order_id.street ]]</para><para style="P22">[[ o.partner_order_id.street2 or '' ]]</para><para style="P22">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para><para style="P22">[[ o.partner_order_id.state_id and o.partner_order_id.state_id.name or '' ]]</para><para style="P22">[[ o.partner_order_id.country_id and o.partner_order_id.country_id.name or '' ]]</para><para style="P20"><font color="white"> </font></para><para style="P17">T&#xE9;l.&#xA0;: [[ o.partner_order_id.phone or removeParentNode('para') ]]</para><para style="P17">Fax&#xA0;: [[ o.partner_order_id.fax or removeParentNode('para') ]]</para><para style="P17">TVA&#xA0;: [[ o.partner_id.vat or removeParentNode('para') ]]</para></td></tr></blockTable><para style="P2"><font color="white"> </font></para><para style="P23">[[ o.state=='draft' and 'Quotation ' or 'Order ' ]] N&#xB0; : [[ o.name ]]</para><para style="P17"><font color="white"> </font></para><para style="P29">Your order reference : [[ o.client_order_ref or '' ]]</para><para style="P29">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para><para style="P29">Our salesman : [[ o.user_id.name ]]</para><para style="P3">[[ o.topnotes or '' ]] </para><blockTable colWidths="218.0,66.0,50.0,57.0,28.0,54.0,55.0" repeatRows="1" style="Tableau2"><tr><td><para style="P24">Product Description</para></td><td><para style="P25">Applicable Taxes</para></td><td><para style="P24">Date Promised</para></td><td><para style="P24">Qty</para></td><td><para style="P24">Disc.</para></td><td><para style="P24">Unit Price</para></td><td><para style="P24">Net Price</para></td></tr></blockTable><section><para style="P26">[[repeatIn(order_lines_by_categ(o), 'cat')]]</para><para style="P27">[[cat[0][1] ]]</para><section><para style="P26">[[ repeatIn(cat[1],'line') ]]</para><blockTable colWidths="219.0,66.0,49.0,57.0,28.0,53.0,55.0" style="Tableau3"><tr><td><para style="P8">[[ line.name ]]</para></td><td><para style="P9">[[ ', '.join(map(lambda x: x.name, line.tax_id))]]</para></td><td><para style="P9">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para></td><td><para style="P11">[[ line.product_uom_qty ]] [[ line.product_uom.name ]]</para></td><td><para style="P8">[[ (line.discount and str(line.discount)+'%')or '' ]]</para></td><td><para style="P12">[[ '%.2f' % line.price_unit ]]</para></td><td><para style="P10">[[ '%.2f' % line.price_subtotal ]]</para></td></tr></blockTable><para style="P26"><font color="white"> </font></para></section><blockTable colWidths="52.0,366.0,110.0" style="Tableau8"><tr><td><para style="P13">[[ repeatIn((line.notes and [line.notes]) or [], 'l') ]]</para></td><td><para style="P14">[[ l ]] [[ setTag('para','xpre') ]]</para></td><td><para style="P13"><font color="white"> </font></para></td></tr></blockTable></section><blockTable colWidths="348.0,69.0,110.0" style="Tableau9"><tr><td><para style="P30"><font color="white"> </font></para></td><td><para style="P31">Net Total&#xA0;:</para></td><td><para style="P31">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr><tr><td><para style="P30"><font color="white"> </font></para></td><td><para style="P31">Taxes&#xA0;:</para></td><td><para style="P31">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr><tr><td><para style="P28"><font color="white"> </font></para></td><td><para style="P15">TOTAL&#xA0;:</para></td><td><para style="P15">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para></td></tr></blockTable><para style="P16"><font color="white"> </font></para><para style="P16"><font color="white"> </font></para><blockTable colWidths="527.0" style="Tableau4"><tr><td><para style="P4">[[ format(o.note or '') ]]</para></td></tr><tr><td><para style="P4">[[ format((o.partner_id.property_payment_term and o.partner_id.property_payment_term[1]) or '') ]]</para></td></tr></blockTable><para style="P5"><font color="white"> </font></para></story></document>
-
diff --git a/addons/sale_category/sale.py b/addons/sale_category/sale.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/sale_category/sale.py
+++ /dev/null
diff --git a/addons/sale_category/sale_category_report.xml b/addons/sale_category/sale_category_report.xml
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/sale_category/sale_category_report.xml
+++ /dev/null
diff --git a/addons/sale_category/sale_category_view.xml b/addons/sale_category/sale_category_view.xml
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/addons/sale_category/sale_category_view.xml
+++ /dev/null
diff --git a/addons/sale_crm/__init__.py b/addons/sale_crm/__init__.py
deleted file mode 100644
index 5a3f5f3df2d..00000000000
--- a/addons/sale_crm/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
diff --git a/addons/sale_crm/__terp__.py b/addons/sale_crm/__terp__.py
deleted file mode 100644
index 8b4c842e038..00000000000
--- a/addons/sale_crm/__terp__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "Sale CRM Stuff",
- "version" : "1.0",
- "author" : "Tiny",
- "website" : "http://tinyerp.com/module_sale.html",
- "depends" : ["sale", "crm"],
- "category" : "Generic Modules/Sales & Purchases",
- "description": """
- This module adds a shortcut on one or several cases in the CRM.
- This shortcut allows you to generate a sale order based the selected case.
- If different cases are open (a list), it generates one sale order by
- case.
-
- The case is then closed and linked to the generated sale order.
- """,
- "init_xml" : [],
- "demo_xml" : [],
- "update_xml" : ["sale_crm_wizard.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/sale_crm/sale_crm_wizard.xml b/addons/sale_crm/sale_crm_wizard.xml
deleted file mode 100644
index d7d8ddaf533..00000000000
--- a/addons/sale_crm/sale_crm_wizard.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" ?>
-<terp>
- <data>
- <wizard string="Make an order" model="crm.case" name="crm.case.make_order" keyword="client_action_multi" id="sale_crm_wizard" />
- </data>
-</terp>
diff --git a/addons/sale_crm/wizard/__init__.py b/addons/sale_crm/wizard/__init__.py
deleted file mode 100644
index 601a509f50a..00000000000
--- a/addons/sale_crm/wizard/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: __init__.py 1070 2005-07-29 12:41:24Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import makesale
diff --git a/addons/sale_crm/wizard/makesale.py b/addons/sale_crm/wizard/makesale.py
deleted file mode 100644
index fbc54a9b205..00000000000
--- a/addons/sale_crm/wizard/makesale.py
+++ /dev/null
@@ -1,116 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-
-sale_form = """<?xml version="1.0"?>
-<form string="Make an order">
- <field name="name"/>
- <label string="(Keep Empty for default value)" colspan="2"/>
- <field name="shop_id" required="True" />
- <field name="partner_id" required="True" />
- <field name="picking_policy" required="True" />
-</form>"""
-
-sale_fields = {
- 'name' : {'string' : 'Order name', 'type': 'char'},
- 'shop_id' : {'string' : 'Shop', 'type' : 'many2one', 'relation' : 'sale.shop'},
- 'partner_id' : {'string' : 'Partner', 'type' : 'many2one', 'relation' : 'res.partner', 'readonly':True},
- 'picking_policy': {'string': 'Packing policy', 'type': 'selection', 'selection' : [('direct','Direct Delivery'),('one','All at once')]},
-}
-
-ack_form = """<?xml version="1.0"?>
-<form string="Make an order">
- <separator string="The sale order is now created" />
-</form>"""
-
-ack_fields = {}
-
-class make_sale(wizard.interface):
- def _selectPartner(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- case = service.execute(cr.dbname, uid, 'crm.case', 'read', data['ids'], ['partner_id'])
- return {'partner_id': case[0]['partner_id']}
-
- def _makeOrder(self, cr, uid, data, context):
- case = pooler.get_pool(cr.dbname).get('crm.case')
- sale = pooler.get_pool(cr.dbname).get('sale.order')
- partner_obj = pooler.get_pool(cr.dbname).get('res.partner')
- partner_addr = partner_obj.address_get(cr, uid, [data['form']['partner_id']], ['invoice', 'delivery', 'contact'])
- pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'], context).property_product_pricelist.id
- vals = {
- 'origin': 'BO:%s' % str(data['ids'][0]),
- 'picking_policy': data['form']['picking_policy'],
- 'shop_id': data['form']['shop_id'],
- 'partner_id': data['form']['partner_id'],
- 'pricelist_id': pricelist,
- 'partner_invoice_id': partner_addr['invoice'],
- 'partner_order_id': partner_addr['contact'],
- 'partner_shipping_id': partner_addr['delivery'],
- 'order_policy': 'manual',
- 'date_order': now(),
- }
- if data['form']['name']:
- vals['name'] = data['form']['name']
- nid = sale.create(cr, uid, vals)
- case.write(cr, uid, data['ids'], {'ref': 'sale.order,%s' % nid})
-
- view_type = 'form,tree'
- if len(data['ids']) > 1:
- view_type = 'tree,form'
-
- value = {
- 'domain': "[('id','in',["+','.join(map(str,[nid]))+"])]",
- 'name': 'Create Sale Orders',
- 'view_type': 'form',
- 'view_mode': view_type,
- 'res_model': 'sale.order',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
- if view_type == 'form,tree':
- value['res_id'] = nid
- return value
-
- states = {
- 'init' : {
- 'actions' : [_selectPartner],
- 'result' : {'type' : 'form', 'arch' : sale_form, 'fields' : sale_fields, 'state' : [('end', 'Cancel'),('order', 'Make an order')]}
- },
- 'order' : {
- 'actions' : [_makeOrder],
- 'result' : {'type':'action', 'action':_makeOrder, 'state':'end'}
- }
- }
-make_sale('crm.case.make_order')
diff --git a/addons/sale_journal/__init__.py b/addons/sale_journal/__init__.py
deleted file mode 100644
index 5ad363d0cac..00000000000
--- a/addons/sale_journal/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sale_journal
-import sale_journal_inherit
-import sale_journal_report
-import sale_journal_picking_report
diff --git a/addons/sale_journal/__terp__.py b/addons/sale_journal/__terp__.py
deleted file mode 100644
index bd2f08845d2..00000000000
--- a/addons/sale_journal/__terp__.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Use the custom module to put your specific code in a separate module.
-#
-{
- "name" : "Managing sales and deliveries by journal",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Sales & Purchases",
- "website": "http://www.tinyerp.com",
- "depends" : ["stock","sale"],
- "demo_xml" : ['sale_journal_demo.xml'],
- "init_xml" : ['sale_journal_data.xml'],
- "update_xml" : ["sale_journal_view.xml","picking_journal_view.xml","picking_journal_view_report.xml"],
- "description" : """
- The sale journal modules allows you to categorize your
- sales and deliveries (packing lists) between different journals.
- This module is very helpfull for bigger companies that
- works by departments.
-
- You can use journal for different purposes, some examples:
- * isolate sales of different departments
- * journals for deliveries by truck or by UPS
-
- Journals have a responsible and evolves between different status:
- * draft, open, cancel, done.
-
- Batch operations can be processed on the different journals to
- confirm all sales at once, to validate or invoice packings, ...
-
- It also supports batch invoicing methods that can be configured by
- partners and sales orders, examples:
- * daily invoicing,
- * monthly invoicing, ...
-
- Some statistics by journals are provided.
- """,
- "active": False,
- "installable": True
-}
diff --git a/addons/sale_journal/picking_journal_view.xml b/addons/sale_journal/picking_journal_view.xml
deleted file mode 100644
index f8d1cb580d7..00000000000
--- a/addons/sale_journal/picking_journal_view.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<terp>
-<data>
-
- <record model="ir.ui.view" id="view_picking_journal_form">
- <field name="name">sale_journal.picking.journal.form</field>
- <field name="model">sale_journal.picking.journal</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Packing Journal">
- <notebook>
- <page string="Journal">
- <separator string="Journal Information" colspan="4"/>
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="date_created" select="1"/>
- <field name="date_validation" select="1"/>
- <separator string="States" colspan="4"/>
- <field name="state"/>
- <group col="3" colspan="2">
- <button name="button_open" string="Open Journal" states="draft" type="object"/>
- <button name="button_close" string="Close Journal" states="open" type="object"/>
- <button name="button_draft" string="Set to Draft" states="close,open" type="object"/>
- </group>
- </page>
- <page string="Packings">
- <button string="Cancel Packings" name="button_picking_cancel" states="draft,open" type="object"/>
- <newline/>
- <field name="picking_stats_ids" colspan="4" nolabel="1"/>
- </page><page string="Notes">
- <field name="note" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_picking_journal_tree">
- <field name="name">sale_journal.picking.journal.tree</field>
- <field name="model">sale_journal.picking.journal</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Packing Journal">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_definition_picking_journal">
- <field name="name">Packings journals</field>
- <field name="res_model">sale_journal.picking.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Inventory Control/Configuration/Packings Journals"
- id="menu_definition_journal_pickings"
- action="action_definition_picking_journal"/>
-
-
- <record model="ir.actions.act_window" id="action_definition_picking_journal_tree">
- <field name="name">Packings by journal</field>
- <field name="res_model">sale_journal.picking.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[]</field>
- </record>
- <menuitem
- name="Inventory Control/Packing Lists/Packings by Journal"
- id="menu_definition_journal_picking_by_journal"
- action="action_definition_picking_journal_tree"/>
-
- <record model="ir.actions.act_window" id="action_definition_picking_journal_tree_my">
- <field name="name">My open packing journals</field>
- <field name="res_model">sale_journal.picking.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('user_id','=',uid),('state','=','open')]</field>
- </record>
- <menuitem
- name="Inventory Control/Packing Lists/Packings by Journal/My Open Journals"
- id="menu_definition_journal_pickings_my_open"
- action="action_definition_picking_journal_tree_my"/>
-
- <record model="ir.actions.act_window" id="action_definition_picking_journal_tree_all">
- <field name="name">Packings by journal</field>
- <field name="res_model">sale_journal.picking.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','open')]</field>
- </record>
- <menuitem
- name="Inventory Control/Packing Lists/Packings by Journal/All Open Journals"
- id="menu_definition_journal_pickings_all_open"
- action="action_definition_picking_journal_tree_all"/>
-
-
- <record model="ir.actions.act_window" id="action_invoice_type_tree">
- <field name="name">Packings by invoice_method</field>
- <field name="name">sale_journal.invoice.type.tree</field>
- <field name="res_model">sale_journal.invoice.type</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">tree</field>
- </record>
- <menuitem
- name="Inventory Control/Packing Lists/Sending Goods/Packings to Invoice/Packings by Invoice Method"
- id="menu_action_invoice_type_tree"
- action="action_invoice_type_tree"/>
-
- <record model="ir.actions.act_window" id="action_invoice_type_picking_open">
- <field name="name">Packings to invoice</field>
- <field name="res_model">stock.picking</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
- </record>
- <record model="ir.values" id="ir_open_invoice_type">
- <field name="key2">tree_but_open</field>
- <field name="model">sale_journal.invoice.type</field>
- <field name="name">Packings to invoice</field>
- <field name="value" eval="'ir.actions.act_window,%d'%action_invoice_type_picking_open"/>
- <field name="object" eval="True"/>
- </record>
-
-</data>
-</terp>
diff --git a/addons/sale_journal/picking_journal_view_report.xml b/addons/sale_journal/picking_journal_view_report.xml
deleted file mode 100644
index f90304adeb4..00000000000
--- a/addons/sale_journal/picking_journal_view_report.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<terp>
-<data>
-
- #
- # Packings by invoice type
- #
-
- <record model="ir.ui.view" id="view_picking_invoice_type_stats_form">
- <field name="name">sale_journal.invoice.type.stats.form</field>
- <field name="model">sale_journal.invoice.type.stats</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Packings by invoice method">
- <field name="name" select="1"/>
- <field name="invoice_state" select="1"/>
- <field name="state" select="1"/>
- <field name="invoice_type_id" select="1"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_picking_invoice_type_stats_tree">
- <field name="name">sale_journal.invoice.type.stats.tree</field>
- <field name="model">sale_journal.invoice.type.stats</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Packings by invoice method">
- <field name="name"/>
- <field name="invoice_state"/>
- <field name="state"/>
- <field name="invoice_type_id"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_invoice_type_picking_stats_open">
- <field name="name">Statistics on packings to invoice</field>
- <field name="res_model">sale_journal.invoice.type.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
- </record>
- <record model="ir.values" id="ir_open_invoice_type_stats">
- <field name="key2">tree_but_open</field>
- <field name="model">sale_journal.invoice.type</field>
- <field name="name">Statistics on packings to invoice</field>
- <field name="value" eval="'ir.actions.act_window,%d'%action_invoice_type_picking_stats_open"/>
- <field name="object" eval="True"/>
- </record>
-
- <record model="ir.actions.act_window" id="action_invoice_type_picking_stats_open_menu_month">
- <field name="name">Packings by invoice method</field>
- <field name="res_model">sale_journal.invoice.type.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
- </record>
- <menuitem
- name="Inventory Control/Reporting/This Month/Packings by Invoice Method"
- action="action_invoice_type_picking_stats_open_menu_month"
- id="menu_invoice_type_picking_stats_open_menu"/>
-
- <record model="ir.actions.act_window" id="action_invoice_type_picking_stats_open_menu_all">
- <field name="name">Packings by invoice method</field>
- <field name="res_model">sale_journal.invoice.type.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Inventory Control/Reporting/All Months/Packings by Invoice Method"
- action="action_invoice_type_picking_stats_open_menu_all"
- id="menu_invoice_type_picking_stats_open_all"/>
-
- #
- # Packings by journal
- #
-
- <record model="ir.ui.view" id="view_picking_journal_stats_form">
- <field name="name">sale_journal.picking.stats.form</field>
- <field name="model">sale_journal.picking.stats</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Packings by journals">
- <field name="name" select="1"/>
- <field name="state" select="1"/>
- <field name="journal_id" select="1"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_picking_journal_stats_tree">
- <field name="name">sale_journal.picking.stats.tree</field>
- <field name="model">sale_journal.picking.stats</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Packings by journals">
- <field name="name"/>
- <field name="state"/>
- <field name="journal_id"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_picking_picking_stats_open_menu_month">
- <field name="name">Packings by journal</field>
- <field name="res_model">sale_journal.picking.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
- </record>
- <menuitem
- name="Inventory Control/Reporting/This Month/Packings by Journal"
- action="action_picking_picking_stats_open_menu_month"
- id="menu_picking_picking_stats_open_menu"/>
-
- <record model="ir.actions.act_window" id="action_picking_picking_stats_open_menu_all">
- <field name="name">Packings by journal</field>
- <field name="res_model">sale_journal.picking.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Inventory Control/Reporting/All Months/Packings by Journal"
- action="action_picking_picking_stats_open_menu_all"
- id="menu_picking_picking_stats_open_all"/>
-
-
-
-</data>
-</terp>
diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py
deleted file mode 100644
index d9fc2e7ce97..00000000000
--- a/addons/sale_journal/sale_journal.py
+++ /dev/null
@@ -1,139 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-import netsvc
-import time
-
-class sale_journal_invoice_type(osv.osv):
- _name = 'sale_journal.invoice.type'
- _description = 'Invoice Types'
- _columns = {
- 'name': fields.char('Invoice Type', size=64, required=True),
- 'active': fields.boolean('Active'),
- 'note': fields.text('Note'),
- 'invoicing_method': fields.selection([('simple','Non grouped'),('grouped','Grouped')], 'Invoicing method', required=True),
- }
- _defaults = {
- 'active': lambda *a: True,
- 'invoicing_method': lambda *a:'simple'
- }
-sale_journal_invoice_type()
-
-class sale_journal(osv.osv):
- _name = 'sale_journal.sale.journal'
- _description = 'Sale Journal'
- _columns = {
- 'name': fields.char('Journal', size=64, required=True),
- 'code': fields.char('Code', size=16, required=True),
- 'user_id': fields.many2one('res.users', 'Responsible', required=True),
- 'date': fields.date('Journal date', required=True),
- 'date_created': fields.date('Creation date', readonly=True, required=True),
- 'date_validation': fields.date('Validation date', readonly=True),
- 'sale_stats_ids': fields.one2many("sale_journal.sale.stats", "journal_id", 'Sale Stats', readonly=True),
- 'state': fields.selection([
- ('draft','Draft'),
- ('open','Open'),
- ('done','Done'),
- ], 'Creation date', required=True),
- 'note': fields.text('Note'),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- 'date_created': lambda *a: time.strftime('%Y-%m-%d'),
- 'user_id': lambda self,cr,uid,context: uid,
- 'state': lambda self,cr,uid,context: 'draft',
- }
- def button_sale_cancel(self, cr, uid, ids, context={}):
- for id in ids:
- sale_ids = self.pool.get('sale.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
- for saleid in sale_ids:
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'sale.order', saleid, 'cancel', cr)
- return True
- def button_sale_confirm(self, cr, uid, ids, context={}):
- for id in ids:
- sale_ids = self.pool.get('sale.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
- for saleid in sale_ids:
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'sale.order', saleid, 'order_confirm', cr)
- return True
-
- def button_open(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'open'})
- return True
- def button_draft(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'draft'})
- return True
- def button_close(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'done', 'date_validation':time.strftime('%Y-%m-%d')})
- return True
-sale_journal()
-
-class picking_journal(osv.osv):
- _name = 'sale_journal.picking.journal'
- _description = 'Packings Journal'
- _columns = {
- 'name': fields.char('Journal', size=64, required=True),
- 'code': fields.char('Code', size=16, required=True),
- 'user_id': fields.many2one('res.users', 'Responsible', required=True),
- 'date': fields.date('Journal date', required=True),
- 'date_created': fields.date('Creation date', readonly=True, required=True),
- 'date_validation': fields.date('Validation date', readonly=True),
- 'picking_stats_ids': fields.one2many("sale_journal.picking.stats", "journal_id", 'Journal Stats', readonly=True),
- 'state': fields.selection([
- ('draft','Draft'),
- ('open','Open'),
- ('done','Done'),
- ], 'Creation date', required=True),
- 'note': fields.text('Note'),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- 'date_created': lambda *a: time.strftime('%Y-%m-%d'),
- 'user_id': lambda self,cr,uid,context: uid,
- 'state': lambda self,cr,uid,context: 'draft',
- }
- def button_picking_cancel(self, cr, uid, ids, context={}):
- for id in ids:
- pick_ids = self.pool.get('stock.picking').search(cr, uid, [('journal_id','=',id)])
- for pickid in pick_ids:
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_cancel', cr)
- return True
- def button_open(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'open'})
- return True
- def button_draft(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'draft'})
- return True
- def button_close(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'done', 'date_validation':time.strftime('%Y-%m-%d')})
- return True
-picking_journal()
-
diff --git a/addons/sale_journal/sale_journal_data.xml b/addons/sale_journal/sale_journal_data.xml
deleted file mode 100644
index 2eef0a0f1bd..00000000000
--- a/addons/sale_journal/sale_journal_data.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
- <record model="ir.property" id="property_invoice_type_def">
- <field name="name">property_invoice_type</field>
- <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_invoice_type')]"/>
- <field name="value" eval="False"/>
- </record>
-
-</data>
-</terp>
diff --git a/addons/sale_journal/sale_journal_demo.xml b/addons/sale_journal/sale_journal_demo.xml
deleted file mode 100644
index 268000d880c..00000000000
--- a/addons/sale_journal/sale_journal_demo.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data noupdate="1">
-
- <record model="sale_journal.invoice.type" id="daily">
- <field name="name">Daily invoicing</field>
- </record>
- <record model="sale_journal.invoice.type" id="monthly">
- <field name="name">Monthly invoicing</field>
- <field name="invoicing_method">grouped</field>
- </record>
-
- <record model="ir.property" id="sale_journal.property_invoice_type_def">
- <field name="value" eval="'sale_journal.invoice.type,'+str(daily)"/>
- </record>
-
-</data>
-</terp>
diff --git a/addons/sale_journal/sale_journal_inherit.py b/addons/sale_journal/sale_journal_inherit.py
deleted file mode 100644
index 53478907d7b..00000000000
--- a/addons/sale_journal/sale_journal_inherit.py
+++ /dev/null
@@ -1,78 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import osv, fields
-
-
-class res_partner(osv.osv):
- _inherit = 'res.partner'
- _columns = {
- 'property_invoice_type': fields.property(
- 'sale_journal.invoice.type',
- type='many2one',
- relation='sale_journal.invoice.type',
- string="Invoicing Method",
- method=True,
- view_load=True,
- group_name="Accounting Properties",
- help="The type of journal used for sales and packings."),
- }
-res_partner()
-
-class picking(osv.osv):
- _inherit="stock.picking"
- _columns = {
- 'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal'),
- 'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal'),
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
- }
-picking()
-
-class sale(osv.osv):
- _inherit="sale.order"
- _columns = {
- 'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal'),
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
- }
- def action_ship_create(self, cr, uid, ids, *args):
- result = super(sale, self).action_ship_create(cr, uid, ids, *args)
- for order in self.browse(cr, uid, ids, context={}):
- pids = [ x.id for x in order.picking_ids]
- self.pool.get('stock.picking').write(cr, uid, pids, {
- 'invoice_type_id': order.invoice_type_id.id,
- 'sale_journal_id': order.journal_id.id
- })
- return result
-
- def onchange_partner_id(self, cr, uid, ids, part):
- result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
- if part:
- itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
- result['value']['invoice_type_id'] = itype
- return result
-sale()
diff --git a/addons/sale_journal/sale_journal_picking_report.py b/addons/sale_journal/sale_journal_picking_report.py
deleted file mode 100644
index ed81a1f2392..00000000000
--- a/addons/sale_journal/sale_journal_picking_report.py
+++ /dev/null
@@ -1,119 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class report_sale_journal_invoice_type_stats(osv.osv):
- _name = "sale_journal.invoice.type.stats"
- _description = "Stats on packings by invoice method"
- _auto = False
- _columns = {
- 'name': fields.date('Month', readonly=True),
- 'invoice_state':fields.selection([
- ("invoiced","invoiced"),
- ("2binvoiced","to be invoiced"),
- ("none","None")
- ], "Invoice state", readonly=True),
- 'state': fields.selection([
- ('draft','draft'),
- ('auto','waiting'),
- ('confirmed','confirmed'),
- ('assigned','assigned'),
- ('done','done'),
- ('cancel','cancel'),
- ], 'State', readonly=True),
- 'invoice_type_id':fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- }
- _order = 'state,invoice_state,name desc'
- def init(self, cr):
- cr.execute("""
- create or replace view sale_journal_invoice_type_stats as (
- select
- min(l.id) as id,
- substring(s.date for 7)||'-'||'01' as name,
- s.state,
- s.invoice_state,
- s.invoice_type_id,
- sum(l.product_qty) as quantity,
- count(*) as count,
- sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
- (sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
- from stock_picking s
- right join stock_move l on (s.id=l.picking_id)
- right join sale_order_line ol on (l.sale_line_id=ol.id)
- group by s.invoice_type_id, substring(s.date for 7),s.state, s.invoice_state
- order by s.invoice_type_id, s.invoice_state, s.state
- )
- """)
-report_sale_journal_invoice_type_stats()
-
-class report_sale_journal_picking(osv.osv):
- _name = "sale_journal.picking.stats"
- _description = "Packing lists by Journal"
- _auto = False
- _columns = {
- 'name': fields.date('Month', readonly=True),
- 'state': fields.selection([
- ('draft','draft'),
- ('auto','waiting'),
- ('confirmed','confirmed'),
- ('assigned','assigned'),
- ('done','done'),
- ('cancel','cancel'),
- ], 'State', readonly=True),
- 'journal_id':fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- }
- _order = 'journal_id,name desc,price_total desc'
- def init(self, cr):
- cr.execute("""
- create or replace view sale_journal_picking_stats as (
- select
- min(l.id) as id,
- substring(s.date for 7)||'-'||'01' as name,
- s.state,
- s.journal_id,
- sum(l.product_qty) as quantity,
- count(*) as count,
- sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
- (sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
- from stock_picking s
- right join stock_move l on (s.id=l.picking_id)
- right join sale_order_line ol on (l.sale_line_id=ol.id)
- group by s.journal_id, substring(s.date for 7),s.state
- )
- """)
-report_sale_journal_picking()
diff --git a/addons/sale_journal/sale_journal_report.py b/addons/sale_journal/sale_journal_report.py
deleted file mode 100644
index 5f6febd20b6..00000000000
--- a/addons/sale_journal/sale_journal_report.py
+++ /dev/null
@@ -1,74 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-
-class report_sale_journal_sale(osv.osv):
- _name = "sale_journal.sale.stats"
- _description = "Sales Orders by Journal"
- _auto = False
- _columns = {
- 'name': fields.date('Month', readonly=True),
- 'state': fields.selection([
- ('draft','Quotation'),
- ('waiting_date','Waiting Schedule'),
- ('manual','Manual in progress'),
- ('progress','In progress'),
- ('shipping_except','Shipping Exception'),
- ('invoice_except','Invoice Exception'),
- ('done','Done'),
- ('cancel','Cancel')
- ], 'Order State', readonly=True),
- 'journal_id':fields.many2one('sale_journal.sale.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
- }
- _order = 'journal_id,name desc,price_total desc'
- def init(self, cr):
- cr.execute("""
- create or replace view sale_journal_sale_stats as (
- select
- min(l.id) as id,
- substring(s.date_order for 7)||'-'||'01' as name,
- s.state,
- s.journal_id,
- sum(l.product_uom_qty) as quantity,
- count(*),
- sum(l.product_uom_qty*l.price_unit) as price_total,
- (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
- from sale_order s
- right join sale_order_line l on (s.id=l.order_id)
- group by s.journal_id, substring(s.date_order for 7),s.state
- )
- """)
-report_sale_journal_sale()
-
-
diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml
deleted file mode 100644
index dce5a3585d2..00000000000
--- a/addons/sale_journal/sale_journal_view.xml
+++ /dev/null
@@ -1,300 +0,0 @@
-<terp>
-<data>
- <record model="ir.ui.view" id="view_sale_journal_invoice_type_form">
- <field name="name">sale_journal.invoice.type.form</field>
- <field name="model">sale_journal.invoice.type</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Invoice Type">
- <field name="name" select="1"/>
- <field name="active" select="1"/>
- <field name="invoicing_method" select="1"/>
- <newline/>
- <field name="note" colspan="4"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_sale_journal_invoice_type_tree">
- <field name="name">sale_journal.invoice.type.tree</field>
- <field name="model">sale_journal.invoice.type</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Invoice Type">
- <field name="name"/>
- <field name="invoicing_method"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_definition_journal_invoice_type">
- <field name="res_model">Invoice type</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Sales Management/Configuration/Invoicing Methods"
- id="menu_definition_journal_invoice_type"
- action="action_definition_journal_invoice_type"/>
-
- <record model="ir.ui.view" id="view_sale_journal_form">
- <field name="name">sale_journal.sale.journal.form</field>
- <field name="model">sale_journal.sale.journal</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Sale Journal">
- <notebook>
- <page string="Journal">
- <separator string="Journal Information" colspan="4"/>
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="date_created" select="1"/>
- <field name="date_validation" select="1"/>
- <separator string="States" colspan="4"/>
- <field name="state"/>
- <group col="3" colspan="2">
- <button name="button_open" string="Open Journal" states="draft" type="object"/>
- <button name="button_close" string="Close Journal" states="open" type="object"/>
- <button name="button_draft" string="Set to Draft" states="close,open" type="object"/>
- </group>
- </page>
- <page string="Sales">
- <button string="Confirm Sales" name="button_sale_confirm" states="draft,open" type="object"/>
- <button string="Cancel Sales" name="button_sale_cancel" states="draft,open" type="object"/>
- <newline/>
- <field name="sale_stats_ids" colspan="4" nolabel="1">
- <tree string="Sales">
- <field name="name"/>
- <field name="quantity"/>
- <field name="price_total"/>
- <field name="price_average"/>
- <field name="count"/>
- <field name="state"/>
- </tree>
- </field>
- </page><page string="Notes">
- <field name="note" colspan="4" nolabel="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_sale_journal_tree">
- <field name="name">sale_journal.sale.journal.tree</field>
- <field name="model">sale_journal.sale.journal</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Sale Journal">
- <field name="name" select="1"/>
- <field name="code" select="1"/>
- <field name="user_id" select="1"/>
- <field name="date" select="1"/>
- <field name="state"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_definition_journal">
- <field name="res_model">sale_journal.sale.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Sales Management/Configuration/Sales Journals"
- id="menu_definition_journal"
- action="action_definition_journal"/>
-
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree">
- <field name="res_model">sale_journal.sale.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[]</field>
- </record>
- <menuitem
- name="Sales Management/Sales by Journal"
- id="menu_definition_journal_sales"
- action="action_definition_journal_tree"/>
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree_my">
- <field name="name">My open journals</field>
- <field name="res_model">sale_journal.sale.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('user_id','=',uid),('state','=','open')]</field>
- </record>
- <menuitem
- name="Sales Management/Sales by Journal/My Open Journals"
- id="menu_definition_journal_sales_my_open"
- action="action_definition_journal_tree_my"/>
-
- <record model="ir.actions.act_window" id="action_definition_journal_tree_all">
- <field name="name">Open journals</field>
- <field name="res_model">sale_journal.sale.journal</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('state','=','open')]</field>
- </record>
- <menuitem
- name="Sales Management/Sales by Journal/All Open Journals"
- id="menu_definition_journal_sales_all_open"
- action="action_definition_journal_tree_all"/>
-
-
- <record model="ir.ui.view" id="sale_journal_sale_order">
- <field name="name">sale.order.journal.view.form</field>
- <field name="type">form</field>
- <field name="model">sale.order</field>
- <field name="inherit_id" ref="sale.view_order_form" />
- <field name="arch" type="xml">
- <field name="client_order_ref" position="after">
- <field name="journal_id" select="1"/>
- <field name="invoice_type_id" select="1"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="sale_journal_sale_order_tree">
- <field name="name">sale.order.journal.view.tree</field>
- <field name="type">tree</field>
- <field name="model">sale.order</field>
- <field name="inherit_id" ref="sale.view_order_tree" />
- <field name="arch" type="xml">
- <field name="state" position="after">
- <field name="journal_id"/>
- <field name="invoice_type_id"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="sale_journal_picking_order">
- <field name="name">stock.picking.journal.view.form</field>
- <field name="type">form</field>
- <field name="model">stock.picking</field>
- <field name="inherit_id" ref="stock.view_picking_form" />
- <field name="arch" type="xml">
- <field name="origin" position="after">
- <field name="invoice_type_id" select="1"/>
- <field name="sale_journal_id" select="1"/>
- <field name="journal_id" select="1"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="sale_journal_picking_order_tree">
- <field name="name">stock.picking.journal.view.tree</field>
- <field name="type">tree</field>
- <field name="model">stock.picking</field>
- <field name="inherit_id" ref="stock.vpicktree" />
- <field name="arch" type="xml">
- <field name="invoice_state" position="after">
- <field name="sale_journal_id" select="1"/>
- <field name="invoice_type_id" select="1"/>
- <field name="journal_id" select="1"/>
- </field>
- </field>
- </record>
-
-
-
-
- <record model="ir.ui.view" id="view_sale_journal_sale_stats_tree">
- <field name="name">sale_journal.sale.stats.tree</field>
- <field name="model">sale_journal.sale.stats</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Sales by Journal">
- <field name="name"/>
- <field name="state"/>
- <field name="journal_id"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_sale_journal_sale_stats_form">
- <field name="name">sale_journal.sale.stats.form</field>
- <field name="model">sale_journal.sale.stats</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Sales by Journal">
- <field name="name" select="1"/>
- <field name="state" select="1"/>
- <field name="journal_id" select="1"/>
- <field name="quantity"/>
- <field name="count"/>
- <field name="price_total"/>
- <field name="price_average"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_sale_sale_stats_open_menu_month">
- <field name="name">Sales by journal (this month)</field>
- <field name="res_model">sale_journal.sale.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
- </record>
- <menuitem
- name="Sales Management/Reporting/This Month/Sales by Journal"
- action="action_sale_sale_stats_open_menu_month"
- id="menu_sale_sale_stats_open_menu"/>
-
- <record model="ir.actions.act_window" id="action_sale_sale_stats_open_menu_all">
- <field name="res_model">sale_journal.sale.stats</field>
- <field name="type">ir.actions.act_window</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem
- name="Sales Management/Reporting/All Months/Sales by Journal"
- action="action_sale_sale_stats_open_menu_all"
- id="menu_sale_sale_stats_open_all"/>
-
- <act_window name="Monthly sales"
- domain="[('journal_id', '=', active_id)]"
- res_model="sale_journal.sale.stats"
- src_model="sale_journal.sale.journal"
- id="act_sale_journal_sale_journal_2_sale_journal_sale_stats"/>
-
- <act_window name="Assigned packings"
- domain="[('journal_id', '=', active_id),('state', '=', 'assigned')]"
- res_model="stock.picking"
- src_model="sale_journal.picking.journal"
- id="act_sale_journal_picking_journal_2_stock_picking_assigned"/>
-
- <act_window name="Confirmed packings"
- domain="[('journal_id', '=', active_id),('state', '=', 'confirmed')]"
- res_model="stock.picking"
- src_model="sale_journal.picking.journal"
- id="act_sale_journal_picking_journal_2_stock_picking_confirmed"/>
-
- <act_window name="Assigned packings"
- domain="[('sale_journal_id', '=', active_id),('state', '=', 'assigned')]"
- res_model="stock.picking"
- src_model="sale_journal.sale.journal"
- id="act_sale_journal_sale_journal_2_stock_picking_assigned"/>
-
- <act_window name="Confirmed packings"
- domain="[('sale_journal_id', '=', active_id),('state', '=', 'confirmed')]"
- res_model="stock.picking"
- src_model="sale_journal.sale.journal"
- id="act_sale_journal_sale_journal_2_stock_picking_confirmed"/>
-
- <act_window name="Draft sales"
- domain="[('journal_id', '=', active_id),('state', '=', 'draft')]"
- res_model="sale.order"
- src_model="sale_journal.sale.journal"
- id="act_sale_journal_sale_journal_2_sale_order_draft"/>
-
- <act_window name="Approved sales"
- domain="[('journal_id', '=', active_id),('state', '=', 'approved')]"
- res_model="sale.order"
- src_model="sale_journal.sale.journal"
- id="act_sale_journal_sale_journal_2_sale_order_approved"/>
-
-
-</data>
-</terp>
diff --git a/addons/sale_rebate/__init__.py b/addons/sale_rebate/__init__.py
deleted file mode 100644
index b1d32d95689..00000000000
--- a/addons/sale_rebate/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sale
diff --git a/addons/sale_rebate/__terp__.py b/addons/sale_rebate/__terp__.py
deleted file mode 100644
index 22090f1eb98..00000000000
--- a/addons/sale_rebate/__terp__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "Sales Management extented with rebates",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Others",
- "website": "http://www.tinyerp.com",
- "depends" : ["base", "sale"],
- "init_xml" : [],
- "update_xml" : ['sale_view.xml'],
- "active": False,
- "installable": False
-}
diff --git a/addons/sale_rebate/sale.py b/addons/sale_rebate/sale.py
deleted file mode 100644
index 13e92c763d6..00000000000
--- a/addons/sale_rebate/sale.py
+++ /dev/null
@@ -1,187 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields, osv
-import ir
-
-class partner_wh_rebate(osv.osv):
- _name = "res.partner"
- _inherit = "res.partner"
- _columns = {
- 'rebate': fields.float('Rebate (%)', digits=(5, 2)),
- }
-partner_wh_rebate()
-
-class sale_order_rebate(osv.osv):
- _name = "sale.order"
- _inherit = "sale.order"
-
- def _amount_wo_rebate(self, cr, uid, ids, field_name, arg, context):
- return super(sale_order_rebate, self)._amount_untaxed(cr, uid, ids, field_name, arg, context)
-
- def _amount_rebate(self, cr, uid, ids, field_name, arg, context):
- wo_rebate = self._amount_wo_rebate(cr, uid, ids, field_name, arg, context)
- orders = self.read(cr, uid, ids, ['rebate_percent'], context)
- rebates = dict([(o['id'], o['rebate_percent']) for o in orders])
- res = {}
- for id in ids:
- res[id] = wo_rebate.get(id, 0.0) * (rebates.get(id, 0.0) / 100.0)
- return res
-
- def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
- wo_rebate = self._amount_wo_rebate(cr, uid, ids, field_name, arg, context)
- rebate = self._amount_rebate(cr, uid, ids, field_name, arg, context)
- res = {}
- for id in ids:
- res[id] = wo_rebate.get(id, 0.0) - rebate.get(id, 0.0)
- return res
-
- def _amount_tax(self, cr, uid, ids, field_name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for order in self.browse(cr, uid, ids):
- val = 0.0
- cur=order.pricelist_id.currency_id
- for line in order.order_line:
- for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, order.partner_invoice_id.id):
- val += cur_obj.round(cr, uid, cur, (c['amount'] * (100.0 - order.rebate_percent) / 100.0))
- res[order.id] = cur_obj.round(cr, uid, cur, val)
- return res
-
- _columns = {
- 'rebate_percent': fields.float('Rebate (%)', digits=(5, 2), readonly=True, states={'draft':[('readonly',False)]}),
-# 'rebate_account': fields.many2one('account.account', 'Rebate account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'amount_wo_rebate': fields.function(_amount_wo_rebate, method=True, string='Intermediate sum'),
- 'amount_rebate': fields.function(_amount_rebate, method=True, string='Rebate'),
- 'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
- 'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
- }
- _defaults = {
- 'rebate_percent': lambda *a: 0.0,
- }
-
- #
- # Why not using super().onchange_partner_id ?
- #
- def onchange_partner_id(self, cr, uid, ids, partner_id):
- if not partner_id:
- return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False}}
- partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
- addr = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['delivery', 'invoice', 'contact'])
- pricelist = partner.property_product_pricelist.id
- return {
- 'value': {
- 'rebate_percent': partner.rebate or 0.0,
- 'partner_invoice_id': addr['invoice'],
- 'partner_order_id': addr['contact'],
- 'partner_shipping_id': addr['delivery'],
- 'pricelist_id': pricelist
- }
- }
-
- def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
- assert len(ids)==1, "Can only invoice one sale order at a time"
- invoice_id = super(sale_order_rebate, self).action_invoice_create(cr, uid, ids, grouped, states)
- if invoice_id:
- order = self.browse(cr, uid, ids[0])
- inv_obj = self.pool.get('account.invoice')
- inv_obj.write(cr, uid, [invoice_id], {'rebate_percent': order.rebate_percent})
- inv_obj.button_compute(cr, uid, [invoice_id])
- return invoice_id
-sale_order_rebate()
-
-class account_invoice_wh_rebate(osv.osv):
- _name = "account.invoice"
- _inherit = "account.invoice"
-
- def _amount_wo_rebate(self, cr, uid, ids, field_name, arg, context):
- return super(account_invoice_wh_rebate, self)._amount_untaxed(cr, uid, ids, field_name, arg, context)
-
- def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
- un_taxed = super(account_invoice_wh_rebate, self)._amount_untaxed(cr, uid, ids, field_name, arg, context)
- res = {}
- for invoice in self.browse(cr, uid, ids):
- res[invoice.id] = un_taxed[invoice.id] - invoice.rebate_amount
- return res
-
- _columns = {
- 'amount_wo_rebate': fields.function(_amount_wo_rebate, method=True, string='Intermediate sum'),
- 'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
- 'rebate_percent': fields.float('Rebate (%)', digits=(5, 2), readonly=True),
- 'rebate_amount': fields.float('Rebate amount', digits=(14, 2), readonly=True)
- }
-account_invoice_wh_rebate()
-
-class account_invoice_line_wh_rebate(osv.osv):
- _name = "account.invoice.line"
- _inherit = "account.invoice.line"
-
- def move_line_get(self, cr, uid, invoice_id):
- invoice = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
- res = []
- tax_grouped = {}
- tax_obj = self.pool.get('account.tax')
-#TODO: rewrite using browse instead of the manual SQL queries
- cr.execute('SELECT * FROM account_invoice_line WHERE invoice_id=%d', (invoice_id,))
- lines = cr.dictfetchall()
- rebate_percent = invoice.rebate_percent
- rebate_amount = 0.0
- for line in lines:
- price_unit = line['price_unit'] * (100.0 - rebate_percent) / 100.0
- res.append({'type':'src', 'name':line['name'], 'price_unit':price_unit, 'quantity':line['quantity'], 'price':round(line['quantity']*price_unit, 2), 'account_id':line['account_id']})
- cr.execute('SELECT tax_id FROM account_invoice_line_tax WHERE invoice_line_id=%d', (line['id'],))
- rebate_amount += (line['price_unit'] * rebate_percent / 100.0) * line['quantity']
- for (tax_id,) in cr.fetchall():
- # even though we pass only one tax id at a time to compute, it can return several results
- # in case a tax has a parent tax
- sequence = tax_obj.read(cr, uid, [tax_id], ['sequence'])[0]['sequence']
- for tax in tax_obj.compute(cr, uid, [tax_id], price_unit, line['quantity'], invoice.address_invoice_id.id):
- tax['sequence'] = sequence
- if invoice.type in ('out_invoice','in_refund'):
- tax['account_id'] = tax['account_collected_id']
- else:
- tax['account_id'] = tax['account_paid_id']
- key = tax['account_id']
- if not key in tax_grouped:
- tax_grouped[key] = tax
- else:
- tax_grouped[key]['amount'] += tax['amount']
- # delete automatic tax lines for this invoice
- cr.execute("DELETE FROM account_invoice_tax WHERE NOT manual AND invoice_id=%d", (invoice_id,))
-
- # (re)create them
- ait = self.pool.get('account.invoice.tax')
- for t in tax_grouped.values():
- ait.create(cr, uid, {'invoice_id':invoice_id, 'name':t['name'], 'account_id':t['account_id'], 'amount':t['amount'], 'manual':False, 'sequence':t['sequence']})
-
- # update rebate amount for this invoice
- self.pool.get('account.invoice').write(cr, uid, [invoice_id], {'rebate_amount': rebate_amount})
- return res
-account_invoice_line_wh_rebate()
-
diff --git a/addons/sale_rebate/sale_view.xml b/addons/sale_rebate/sale_view.xml
deleted file mode 100644
index 00d59d15a7d..00000000000
--- a/addons/sale_rebate/sale_view.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <record model="ir.ui.view" id="view_partner_form">
- <field name="name">res.partner.form.inherit</field>
- <field name="model">res.partner</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="base.view_partner_form"/>
- <field name="arch" type="xml">
- <field name="lang" position="after">
- <field name="rebate"/>
- </field>
- </field>
- </record>
-
- <!-- sale order -->
- <record model="ir.ui.view" id="view_order_form1">
- <field name="name">sale.order.form</field>
- <field name="model">sale.order</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="sale.view_order_form"/>
- <field name="arch" type="xml">
- <field name="project_id" position="after">
- <field name="rebate_percent"/>
-<!--
- <field name="rebate_account"/>
--->
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_order_form2">
- <field name="name">sale.order.form</field>
- <field name="model">sale.order</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="sale.view_order_form"/>
- <field name="arch" type="xml">
- <group colspan="4" col="7" position="before">
- <field name="amount_wo_rebate"/>
- <field name="amount_rebate"/>
- </group>
- </field>
- </record>
-
- <!-- invoice -->
- <record model="ir.ui.view" id="view_invoice_form1">
- <field name="name">account.invoice.form</field>
- <field name="model">account.invoice</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="account.invoice_form"/>
- <field name="arch" type="xml">
- <field name="project_id" position="after">
- <field name="rebate_percent"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_invoice_form2">
- <field name="name">account.invoice.form</field>
- <field name="model">account.invoice</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="account.invoice_form"/>
- <field name="arch" type="xml">
- <group colspan="4" col="7" position="before">
- <field name="amount_wo_rebate"/>
- <field name="rebate_amount"/>
- </group>
- </field>
- </record>
- </data>
-</terp>
-
diff --git a/addons/sale_tax_include/__init__.py b/addons/sale_tax_include/__init__.py
deleted file mode 100644
index 980689f17f8..00000000000
--- a/addons/sale_tax_include/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sale_tax_incl
diff --git a/addons/sale_tax_include/__terp__.py b/addons/sale_tax_include/__terp__.py
deleted file mode 100644
index a2775b605cd..00000000000
--- a/addons/sale_tax_include/__terp__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name" : "Invoices and prices with taxes included",
- "version" : "1.0",
- "depends" : ["sale","account_tax_include"],
- "author" : "Tiny",
- "website" : "http://tinyerp.com/module_account.html",
- "category" : "Generic Modules/Sales & Purchases",
- "init_xml" : [ ],
- "demo_xml" : [ ],
- "update_xml" : [ 'sale_tax_incl.xml' ],
- "active": False,
- "installable": True
-}
diff --git a/addons/sale_tax_include/sale_tax_incl.py b/addons/sale_tax_include/sale_tax_incl.py
deleted file mode 100644
index e623d8844a7..00000000000
--- a/addons/sale_tax_include/sale_tax_incl.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-import netsvc
-from osv import fields, osv
-import ir
-
-class sale_order(osv.osv):
- _inherit = "sale.order"
- def _amount_tax(self, cr, uid, ids, field_name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for order in self.browse(cr, uid, ids):
- val = 0.0
- cur=order.pricelist_id.currency_id
- for line in order.order_line:
- if order.price_type=='tax_included':
- ttt = self.pool.get('account.tax').compute_inv(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0)/100.0), line.product_uom_qty, order.partner_invoice_id.id, line.product_id, order.partner_id)
- else:
- ttt = self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0)/100.0), line.product_uom_qty, order.partner_invoice_id.id, line.product_id, order.partner_id)
- for c in ttt:
- val += cur_obj.round(cr, uid, cur, c['amount'])
- res[order.id]=cur_obj.round(cr, uid, cur, val)
- return res
- _columns = {
- 'price_type': fields.selection([
- ('tax_included','Tax included'),
- ('tax_excluded','Tax excluded')
- ], 'Price method', required=True),
- 'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
- }
- _defaults = {
- 'price_type': lambda *a: 'tax_excluded',
- }
- def _inv_get(self, cr, uid, order, context={}):
- return {
- 'price_type': order.price_type
- }
-sale_order()
-
-class sale_order_line(osv.osv):
- _inherit = "sale.order.line"
- def _amount_line(self, cr, uid, ids, name, arg, context):
- res = {}
- cur_obj=self.pool.get('res.currency')
- tax_obj = self.pool.get('account.tax')
- res = super(sale_order_line, self)._amount_line(cr, uid, ids, name, arg, context)
- res2 = res.copy()
- for line in self.browse(cr, uid, ids):
- if line.product_uos.id:
- qty = line.product_uos_qty
- else:
- qty = line.product_uom_qty
- if line.order_id.price_type == 'tax_included':
- if line.product_id:
- for tax in tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, res[line.id]/qty, qty):
- res[line.id] = res[line.id] - tax['amount']
- else:
- for tax in tax_obj.compute_inv(cr, uid, line.tax_id, res[line.id]/qty, qty):
- res[line.id] = res[line.id] - tax['amount']
- if name == 'price_subtotal_incl' and line.order_id.price_type == 'tax_included':
- if line.product_id:
- prod_taxe_ids = [ t.id for t in line.product_id.taxes_id ]
- prod_taxe_ids.sort()
- line_taxe_ids = [ t.id for t in line.tax_id ]
- line_taxe_ids.sort()
- if line.product_id and prod_taxe_ids == line_taxe_ids:
- res[line.id] = res2[line.id]
- elif not line.product_id:
- res[line.id] = res2[line.id]
- else:
- for tax in tax_obj.compute(cr, uid, line.tax_id, res[line.id]/qty, qty):
- res[line.id] = res[line.id] + tax['amount']
- cur = line.order_id.pricelist_id.currency_id
- res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
- return res
- _columns = {
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal w/o tax'),
- 'price_subtotal_incl': fields.function(_amount_line, method=True, string='Subtotal'),
- }
-sale_order_line()
-
diff --git a/addons/sale_tax_include/sale_tax_incl.xml b/addons/sale_tax_include/sale_tax_incl.xml
deleted file mode 100644
index 9ba410fccb5..00000000000
--- a/addons/sale_tax_include/sale_tax_incl.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<terp>
-<data>
-
- <record model="ir.ui.view" id="account_tax_view_price">
- <field name="name">sale.order.exlcuded.view.form</field>
- <field name="type">form</field>
- <field name="model">sale.order</field>
- <field name="inherit_id" ref="sale.view_order_form" />
- <field name="arch" type="xml">
- <field name="client_order_ref" position="after">
- <field name="price_type"/>
- </field>
- </field>
- </record>
- <record model="ir.ui.view" id="account_tax_view_subtotal_incl">
- <field name="name">sale.order.exlcuded.view.form</field>
- <field name="type">form</field>
- <field name="model">sale.order</field>
- <field name="inherit_id" ref="sale.view_order_form" />
- <field name="arch" type="xml">
- <field name="price_subtotal" position="after">
- <field name="price_subtotal_incl"/>
- </field>
- </field>
- </record>
-
-</data>
-</terp>
-
diff --git a/addons/sandwich/__init__.py b/addons/sandwich/__init__.py
deleted file mode 100644
index 09e2c515ccc..00000000000
--- a/addons/sandwich/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import sandwich
-import report
-import wizard
diff --git a/addons/sandwich/__terp__.py b/addons/sandwich/__terp__.py
deleted file mode 100644
index 5059c9f96d4..00000000000
--- a/addons/sandwich/__terp__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name" : "Sandwich Module",
- "author" : "Tiny",
- "version" : "1.0",
- "category" : "Generic Modules/Others",
- "depends" : ["base", "product"],
- "demo_xml" : ["sandwich_demo.xml"],
- "update_xml" : ["sandwich_view.xml", "sandwich_report.xml", "sandwich_wizard.xml"],
- "active": False,
- "installable": True
-}
diff --git a/addons/sandwich/report/__init__.py b/addons/sandwich/report/__init__.py
deleted file mode 100644
index 6aa6b5f4e4f..00000000000
--- a/addons/sandwich/report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import sandwich_report
diff --git a/addons/sandwich/report/sandwich_report.py b/addons/sandwich/report/sandwich_report.py
deleted file mode 100644
index 4eaf8070a76..00000000000
--- a/addons/sandwich/report/sandwich_report.py
+++ /dev/null
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-
-import time
-from report import report_sxw
-
-#
-# sandwich command report
-#
-class sandwich_order_print(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(sandwich_order_print, self).__init__(cr, uid, name, context)
- self.localcontext.update( {
- 'time': time,
- })
-
-report_sxw.report_sxw('report.sandwich.order.print','sandwich.order','addons/sandwich/report/sandwich_report.rml',parser=sandwich_order_print)
diff --git a/addons/sandwich/report/sandwich_report.rml b/addons/sandwich/report/sandwich_report.rml
deleted file mode 100644
index e6f63c37d9a..00000000000
--- a/addons/sandwich/report/sandwich_report.rml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <blockBackground colorName="#c0c0c0" start="0,0" stop="0,0"/>
- <blockBackground colorName="#c0c0c0" start="1,0" stop="1,0"/>
- <blockBackground colorName="#c0c0c0" start="2,0" stop="2,0"/>
- <blockBackground colorName="#c0c0c0" start="3,0" stop="3,0"/>
- <blockBackground colorName="#c0c0c0" start="4,0" stop="4,0"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
- <paraStyle name="P2" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P4" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P5" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="P6" fontName="Times-Roman" fontSize="12.0" leading="15"/>
- <paraStyle name="P7" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
- <paraStyle name="P8" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
- <paraStyle name="P9" fontName="Times-Roman" alignment="RIGHT"/>
- <paraStyle name="P10" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
- <paraStyle name="Standard" fontName="Times-Roman"/>
- <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Times-Roman"/>
- <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
- <paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman"/>
- </stylesheet>
- <story>
- <para style="P1">[[ repeatIn(objects, 'o') ]]</para>
- <blockTable colWidths="280.0,202.0" repeatRows="1" style="Tableau2">
- <tr>
- <td>
- <para style="Table Contents">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="P2">[[ o.partner['name'] ]]</para>
- <para style="P2">[[ o.partner.address[0]['street'] ]]</para>
- <para style="P2">[[ o.partner.address[0]['street2'] ]]</para>
- <para style="P2">[[ o.partner.address[0]['zip'] ]], [[ o.partner.address[0]['city'] ]]</para>
- <para style="P2">[[ o.partner.address[0].state_id['name'] ]]</para>
- <para style="P2">[[ o.partner.address[0].country_id['name'] ]]</para>
- <para style="P2">
- <font color="white"> </font>
- </para>
- <para style="P2">
- <font color="white"> </font>
- </para>
- <para style="P2">Phone : [[ o.partner.address[0]['phone'] ]]</para>
- <para style="P2">FAX : [[ o.partner.address[0]['fax'] ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="P2">
- <font color="white"> </font>
- </para>
- <para style="P2">
- <font color="white"> </font>
- </para>
- <para style="P2">Document : [[ o['name'] ]]</para>
- <para style="P2">Date : [[ o['date'] ]]</para>
- <para style="P3">Printing date : [[ time.strftime('%d/%m/%Y') ]]</para>
- <para style="P2">
- <font color="white"> </font>
- </para>
- <para style="P4">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="192.0,71.0,87.0,69.0,64.0" style="Tableau1">
- <tr>
- <td>
- <para style="P5">Item</para>
- </td>
- <td>
- <para style="Table Heading">Quantity</para>
- </td>
- <td>
- <para style="Table Heading">User</para>
- </td>
- <td>
- <para style="Table Heading">Unit price</para>
- </td>
- <td>
- <para style="Table Heading">Total Price</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P6"><b>[[ repeatIn(o.order_lines, 'a') ]]</b>
- [[ a.product_id['name'] ]]</para>
- </td>
- <td>
- <para style="P8">[[ a['quantity'] ]]</para>
- </td>
- <td>
- <para style="P8">[[ a.user_id['login'] ]]</para>
- </td>
- <td>
- <para style="P9">[[ a.product_id['price'] ]]</para>
- </td>
- <td>
- <para style="P9">[[ a.product_id['price'] * a['quantity'] ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="P4">
- <font color="white"> </font>
- </para>
- <para style="P4">
- <font color="white"> </font>
- </para>
- <para style="P4">[[ o['note'] ]]</para>
- <para style="P4">
- <font color="white"> </font>
- </para>
- <para style="P10">
- <font color="white"> </font>
- </para>
- </story>
-</document>
-
diff --git a/addons/sandwich/sandwich.py b/addons/sandwich/sandwich.py
deleted file mode 100644
index 749816b94dc..00000000000
--- a/addons/sandwich/sandwich.py
+++ /dev/null
@@ -1,98 +0,0 @@
-import time
-
-from osv import osv, fields
-import pooler
-
-#
-# Type of type of products (food, drink, lsd, other...)
-#
-class sandwich_product_type(osv.osv):
- _name = 'sandwich.product.type'
- _columns = {
- 'name': fields.char('Name of the type', size=20, required=True),
- 'description': fields.char('Type\'s description', size=255),
- }
-sandwich_product_type()
-
-
-#
-# Type Of Sandwich
-#
-class sandwich_product(osv.osv):
- _name = 'sandwich.product'
- _columns = {
- 'name': fields.char('Product name', size=50, required=True),
- 'price': fields.float('Product price'),
- 'product_type_id': fields.many2one('sandwich.product.type','Type of product'),
- }
-sandwich_product()
-
-
-#
-# Sandwich command
-#
-class sandwich_order(osv.osv):
- _name = 'sandwich.order'
- _columns = {
- 'name': fields.char('Name', size=50, required=True),
- 'date': fields.date('Order date'),
- 'order_lines': fields.one2many('sandwich.order.line','order_id','Order lines'),
- 'note': fields.text('Notes'),
- 'partner': fields.many2one('res.partner','Partner', required=True),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- }
-sandwich_order()
-
-
-#
-# Sandwich lines of command
-#
-class sandwich_order_line(osv.osv):
- _name = 'sandwich.order.line'
- _columns = {
- 'name': fields.char('Description', size=50, required=True),
- 'product_id': fields.many2one('sandwich.product', 'Product'),
- 'user_id': fields.many2one('res.users', 'User id', required=True),
- 'quantity': fields.integer('Quantity', required=True),
- 'order_id': fields.many2one('sandwich.order', 'Order'),
- 'date': fields.date('Date'),
- 'product_type_id':fields.many2one('sandwich.product.type','Product type',change_default=True),
- }
- _defaults = {
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
- 'user_id': lambda self, cr, uid, c: uid,
- 'quantity': lambda *a: 1
- }
-
- def onchange_user_id(self, cr, uid, id, user_id, product_type_id, context={}, *args):
- # print id, user_id, product_type_id, context
- if (not user_id) or (not product_type_id):
- return {}
- cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
- res = cr.dictfetchone()
- if res:
- return {'value': res}
- # else
- return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
-
- def onchange_product_type_id(self, cr, uid, id, user_id, product_type_id, context={}):
- if (not product_type_id) or (not user_id):
- return {}
- cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
- res = cr.dictfetchone()
- if res:
- return {'value': res}
- # else
- return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
-
- def onchange_product_id(self, cr, uid, id, product_id, context={}):
- if not product_id:
- return {}
- res = pooler.get_pool(cr.dbname).get('sandwich.product').read(cr, uid, [ product_id ], ['name','product_type_id'])
- return {'value': res}
- #return {'value': {'name': name or product_id.name, 'product_type_id': product_id.product_type_id}}
-
-sandwich_order_line()
-
diff --git a/addons/sandwich/sandwich_demo.xml b/addons/sandwich/sandwich_demo.xml
deleted file mode 100644
index adc6a4e6c6f..00000000000
--- a/addons/sandwich/sandwich_demo.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data noupdate="1">
- <record model="sandwich.product.type" id="sandwich">
- <field name="name">sandwich</field>
- <field name="description">something to eat</field>
- </record>
- <record model="sandwich.product.type" id="drink">
- <field name="name">drink</field>
- <field name="description">Something to drink</field>
- </record>
- <record model="sandwich.product.type" id="candy">
- <field name="name">candy</field>
- <field name="description">so sweeeeeet, but so bad for your teeth...</field>
- </record>
-
- <record model="sandwich.product" id="club">
- <field name="name">club</field>
- <field name="price">2.00</field>
- <field name="product_type_id" ref="sandwich"/>
- </record>
- <record model="sandwich.product" id="chicken_curry">
- <field name="name">chicken-curry</field>
- <field name="price">2.00</field>
- <field name="product_type_id" ref="sandwich"/>
- </record>
- <record model="sandwich.product" id="tuna">
- <field name="name">Tuna</field>
- <field name="price">2.50</field>
- <field name="product_type_id" ref="sandwich"/>
- </record>
- <record model="sandwich.product" id="cheese">
- <field name="name">cheese</field>
- <field name="price">1.50</field>
- <field name="product_type_id" ref="sandwich"/>
- </record>
-
- <record model="sandwich.product" id="little_coke">
- <field name="name">Little Coke 0.5l</field>
- <field name="price">1.05</field>
- <field name="product_type_id" ref="drink"/>
- </record>
- <record model="sandwich.product" id="coke">
- <field name="name">Coke 1.0l</field>
- <field name="price">2.00</field>
- <field name="product_type_id" ref="drink"/>
- </record>
- <record model="sandwich.product" id="big_coke">
- <field name="name">Big Coke 2.0l</field>
- <field name="price">3.50</field>
- <field name="product_type_id" ref="drink"/>
- </record>
- <record model="sandwich.product" id="cecemel">
- <field name="name">Cecemel</field>
- <field name="price">1.35</field>
- <field name="product_type_id" ref="drink"/>
- </record>
- <record model="sandwich.product" id="water">
- <field name="name">water</field>
- <field name="price">0.75</field>
- <field name="product_type_id" ref="drink"/>
- </record>
-
- <record model="sandwich.product" id="mars">
- <field name="name">Mars</field>
- <field name="price">0.80</field>
- <field name="product_type_id" ref="candy"/>
- </record>
- <record model="sandwich.product" id="snicker">
- <field name="name">Snickers</field>
- <field name="price">0.80</field>
- <field name="product_type_id" ref="candy"/>
- </record>
- <record model="sandwich.product" id="twix">
- <field name="name">Twix</field>
- <field name="price">1.00</field>
- <field name="product_type_id" ref="candy"/>
- </record>
-
- </data>
-</terp>
diff --git a/addons/sandwich/sandwich_report.xml b/addons/sandwich/sandwich_report.xml
deleted file mode 100644
index 2c3d8cbee3a..00000000000
--- a/addons/sandwich/sandwich_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report id="sandwich_order_print"
- string="Sandwichs order"
- model="sandwich.order"
- name="sandwich.order.print"
- rml="sandwich/report/sandwich_report.rml"
- auto="False"/>
- </data>
-</terp>
diff --git a/addons/sandwich/sandwich_view.xml b/addons/sandwich/sandwich_view.xml
deleted file mode 100644
index 688741d9260..00000000000
--- a/addons/sandwich/sandwich_view.xml
+++ /dev/null
@@ -1,185 +0,0 @@
-<terp>
- <data>
- <menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
- <record model="ir.ui.view" id="sandwich_product_type_view_form">
- <field name="name">sandwich.product.type</field>
- <field name="model">sandwich.product.type</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Product type definition">
- <field name="name" select="1"/>
- <field name="description" select="1" />
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="sandwich_product_type_view_tree">
- <field name="name">sandwich.product.type</field>
- <field name="model">sandwich.product.type</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Product type definition">
- <field name="name"/>
- <field name="description"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_sandwich_product_type">
- <field name="res_model">sandwich.product.type</field>
- <field name="view_type">form</field>
- <field name="view_mode">form,tree</field>
- <field name="domain">[]</field>
- </record>
- <menuitem name="Tools/Sandwich/Configuration/Type of Product" id="menu_action_sandwich_product_type" action="action_sandwich_product_type"/>
-
-
- <record model="ir.ui.view" id="sandwich_product_view_tree">
- <field name="name">sandwich.product</field>
- <field name="model">sandwich.product</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Product definition">
- <field name="name"/>
- <field name="price"/>
- <field name="product_type_id"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="sandwich_product_view_form">
- <field name="name">sandwich.product</field>
- <field name="model">sandwich.product</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Product definition">
- <field name="name" select="1"/>
- <field name="price" select="1" />
- <field name="product_type_id" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_sandwich_product">
- <field name="res_model">sandwich.product</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[]</field>
- </record>
- <menuitem name="Tools/Sandwich/Configuration/Product" id="menu_action_sandwich_product" action="action_sandwich_product"/>
-
-
- <record model="ir.ui.view" id="sandwich_order_line_view_tree">
- <field name="name">sandwich.order.line.tree</field>
- <field name="model">sandwich.order.line</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Product order lines">
- <field name="date"/>
- <field name="product_id"/>
- <field name="quantity"/>
- <field name="user_id" />
- <field name="name"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="sandwich_order_line_view_form">
- <field name="name">sandwich.order.line.form</field>
- <field name="model">sandwich.order.line</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Product order lines">
- <field name="product_type_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
- <field name="user_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
- <field name="product_id" select="1" onchange="onchange_product_id(product_id)" domain="[('product_type_id','=',product_type_id)]"/>
- <field name="quantity" select="1"/>
- <field name="name" select="1"/>
- <field name="date" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_sandwich_order_line">
- <field name="res_model">sandwich.order.line</field>
- <field name="view_type">form</field>
- <field name="domain">[]</field>
- <field name="view_id" ref="sandwich_order_line_view_form"/>
- </record>
- <menuitem name="Tools/Sandwich/Order Lines" id="menu_action_sandwich_order_line" action="action_sandwich_order_line"/>
-
-
- <record model="ir.actions.act_window" id="action_sandwich_my_order_line">
- <field name="name">My order lines</field>
- <field name="res_model">sandwich.order.line</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('user_id','=',uid)]</field>
- </record>
- <menuitem name="Tools/Sandwich/Order Lines/My Order Lines" id="menu_action_sandwich_my_order_line" action="action_sandwich_my_order_line"/>
-
-
- <record model="ir.actions.act_window" id="action_sandwich_my_order_line_of_the_day">
- <field name="name">My order lines of the day</field>
- <field name="res_model">sandwich.order.line</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('user_id','=',uid),('date','=',time.strftime('%Y-%m-%d'))]</field>
- </record>
- <menuitem name="Tools/Sandwich/Order Lines/My Order Lines/My Order Lines of the Day" id="menu_action_sandwich_my_order_line_of_the_day" action="action_sandwich_my_order_line_of_the_day"/>
-
-
- <record model="ir.actions.act_window" id="action_sandwich_order_line_of_the_day">
- <field name="name">Order lines of the day</field>
- <field name="res_model">sandwich.order.line</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
- </record>
- <menuitem name="Tools/Sandwich/Order Lines/Order Lines of the Day" id="menu_action_sandwich_order_line_of_the_day" action="action_sandwich_order_line_of_the_day"/>
-
-
- <record model="ir.ui.view" id="sandwich_order_view_tree">
- <field name="name">sandwich.order.tree</field>
- <field name="model">sandwich.order</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Ordering of this day sandwich">
- <field name="order_lines"/>
- <field name="name"/>
- <field name="note"/>
- <field name="partner"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="sandwich_order_view_form">
- <field name="name">sandwich.order.form</field>
- <field name="model">sandwich.order</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Ordering of this day sandwich">
- <notebook>
- <page string="Sandwich Order">
- <separator string="Informations" colspan="4"/>
- <field name="name" colspan="4" select="1"/>
- <field name="partner" select="1"/>
- <field name="date" select="1"/>
- <separator string="Order lines" colspan="4"/>
- <field name="order_lines" colspan="4"/>
- </page>
- <page string="notes">
- <field name="note" colspan="4" nolabel="1" select="1"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_sandwich_order">
- <field name="name">Today's orders</field>
- <field name="res_model">sandwich.order</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="view_id" eval="False"/>
- <field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
- </record>
- <menuitem name="Tools/Sandwich/Today's Orders" id="menu_action_sandwich_order" action="action_sandwich_order"/>
- </data>
-</terp>
-
diff --git a/addons/sandwich/sandwich_wizard.xml b/addons/sandwich/sandwich_wizard.xml
deleted file mode 100644
index 98da2797e87..00000000000
--- a/addons/sandwich/sandwich_wizard.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <wizard string="Reload / Complete order" id="sandwich_order_wizard" model="sandwich.order" name="sandwich.order.wizard"/>
- <wizard string="Send remind request" id="sandwich_order_recall_wizard" model="sandwich.order" name="sandwich.order.recall.wizard"/>
-
- <record model="ir.actions.wizard" id="wiz_sandwich_create">
- <field name="name">Create Order of the day</field>
- <field name="wiz_name">sandwich.order_create</field>
- </record>
- <menuitem name="Tools/Sandwich/Create Order" action="wiz_sandwich_create" type="wizard" id="sandwich_create_order"/>
-
- </data>
-</terp>
-
diff --git a/addons/sandwich/wizard/__init__.py b/addons/sandwich/wizard/__init__.py
deleted file mode 100644
index d46d04baf18..00000000000
--- a/addons/sandwich/wizard/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import sandwich_wizard
-import order_create
diff --git a/addons/sandwich/wizard/order_create.py b/addons/sandwich/wizard/order_create.py
deleted file mode 100644
index 86d666a307a..00000000000
--- a/addons/sandwich/wizard/order_create.py
+++ /dev/null
@@ -1,79 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-
-sale_form = """<?xml version="1.0"?>
-<form string="Make an order">
- <field name="name" required="True" />
- <field name="partner_id" required="True" />
-</form>"""
-
-sale_fields = {
- 'name' : {'string' : 'Order name', 'type': 'char'},
- 'partner_id' : {'string':'Suplier', 'relation':'res.partner', 'type':'many2one'},
-}
-
-class make_sale(wizard.interface):
- def _makeOrder(self, cr, uid, data, context):
- order = pooler.get_pool(cr.dbname).get('sandwich.order')
- line = pooler.get_pool(cr.dbname).get('sandwich.order.line')
- oid = order.create(cr, uid, {
- 'name': data['form']['name'],
- 'partner': data['form']['partner_id'],
- })
- cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (oid,))
- value = {
- 'domain': "[('id','in',["+str(oid)+"])]",
- 'name': 'Create Sandwich Orders',
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'sandwich.order',
- 'view_id': False,
- 'type': 'ir.actions.act_window',
- 'res_id': oid
- }
- return value
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'form', 'arch' : sale_form, 'fields' : sale_fields, 'state' : [('end', 'Cancel'),('order', 'Make an order')]}
- },
- 'order' : {
- 'actions': [],
- 'result': {'type': 'action', 'action': _makeOrder, 'state':'end'},
- }
- }
-make_sale('sandwich.order_create')
diff --git a/addons/sandwich/wizard/sandwich_wizard.py b/addons/sandwich/wizard/sandwich_wizard.py
deleted file mode 100644
index 6ad05fbdb25..00000000000
--- a/addons/sandwich/wizard/sandwich_wizard.py
+++ /dev/null
@@ -1,128 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-#
-# This class fill in the order with kind of automatically generated order lines, based on the last order for a user concerning a type of product
-#
-class sandwich_order_wizard(wizard.interface):
-
- def _sandwich_order_wizard_order(self, cr, uid, data, context):
- if not len(data['ids']):
- return {}
- cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (data['ids'][0],))
- for order in pooler.get_pool(cr.dbname).get('sandwich.order').browse(cr, uid, data['ids']):
- for user_id in data['form']['user_id'][0][2]:
- for producttype in data['form']['product_type_id'][0][2]:
- if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('product_type_id','=',producttype),('order_id','=',order.id)]):
- vals = {
- 'user_id': user_id,
- 'order_id': order.id,
- 'date': order.date,
- 'product_type_id': producttype
- }
- vals.update( pooler.get_pool(cr.dbname).get('sandwich.order.line').onchange_user_id(cr, uid, uid, user_id, producttype)['value'] )
- pooler.get_pool(cr.dbname).get('sandwich.order.line').create(cr, uid, vals)
- return {}
-
- _sandwich_order_wizard_form = '''<?xml version="1.0"?>
- <form string="Complete order">
- <separator string="Set orders for the day" colspan="4"/>
- <field name="user_id"/>
- <field name="product_type_id"/>
- </form> '''
-
- _sandwich_order_wizard_fields = {
- 'user_id': {'string': 'User', 'type': 'many2many','relation':'res.users'},
- 'product_type_id': {'string': 'Product', 'type': 'many2many', 'relation':'sandwich.product.type'},
- }
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_sandwich_order_wizard_form, 'fields':_sandwich_order_wizard_fields, 'state':[('end','Cancel'),('complete','Complete order')]}
- },
- 'complete': {
- 'actions': [_sandwich_order_wizard_order],
- 'result': {'type': 'state', 'state': 'end'}
- }
- }
-
-sandwich_order_wizard('sandwich.order.wizard')
-
-#
-# This class send a request message to users who don't have their order filled in for this day
-#
-class sandwich_order_recall_wizard(wizard.interface):
- def _sandwich_order_recall_wizard_send(self, cr, uid, data, context):
- for user_id in data['form']['user_id'][0][2]:
- if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('order_id','=',data['id'])]):
- request = pooler.get_pool(cr.dbname).get('res.request')
- request.create(cr, uid, {
- 'name' : "Please order your lunch of the day",
- 'priority' : '0',
- 'state' : 'active',
- 'body' : """Hello,
-
-It seems like you have forgotten to order your sandwich (or meal).
-As it will be ordered soon, it seems to be a rather nice idea to complete your
-order for today ASAP. If you do not, you'll probably get the same meal as yesterday...
-
-Thanks,
-
---
-Tiny ERP
-""",
- 'act_from' : uid,
- 'act_to' : user_id,
- })
- return {}
-
- _sandwich_order_recall_wizard_form = '''<?xml version="1.0"?>
- <form string="Recall orders to users">
- <separator string="List of user to remind the order" colspan="4"/>
- <field name="user_id" colspan="4"/>
- </form>'''
-
- _sandwich_order_recall_wizard_fields = {
- 'user_id': {'string': 'Baaaad users !', 'type': 'many2many', 'relation': 'res.users'},
- }
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type': 'form', 'arch': _sandwich_order_recall_wizard_form, 'fields': _sandwich_order_recall_wizard_fields, 'state': [('end','Cancel'),('send','Send')]},
- },
- 'send' : {
- 'actions' : [_sandwich_order_recall_wizard_send],
- 'result' : {'type': 'state', 'state': 'end'},
- }
- }
-
-sandwich_order_recall_wizard('sandwich.order.recall.wizard')
diff --git a/addons/travel/10000000000000640000004BDD3CD5AB.gif b/addons/travel/10000000000000640000004BDD3CD5AB.gif
deleted file mode 100644
index 3a177cf4ccd..00000000000
--- a/addons/travel/10000000000000640000004BDD3CD5AB.gif
+++ /dev/null
Binary files differ
diff --git a/addons/travel/__init__.py b/addons/travel/__init__.py
deleted file mode 100644
index 3ab61a52eeb..00000000000
--- a/addons/travel/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import custom
diff --git a/addons/travel/__terp__.py b/addons/travel/__terp__.py
deleted file mode 100644
index 4cf70f3788e..00000000000
--- a/addons/travel/__terp__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name" : "Travel",
- "author" : "Tiny",
- "version" : "1.0",
- "depends" : ["base","product"],
- "init_xml" : [],
- "update_xml" : ["custom_view.xml", "custom_report.xml"],
- "category" : "Enterprise Specific Modules/Travel Agencies",
- "active": False,
- "installable": True
-}
diff --git a/addons/travel/custom.py b/addons/travel/custom.py
deleted file mode 100644
index 665799b0400..00000000000
--- a/addons/travel/custom.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from osv import osv, fields
-
-class travel_hostel(osv.osv):
- _name = 'travel.hostel'
- _inherit = 'res.partner'
- _table = 'res_partner'
- _columns = {
- 'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'),
- 'quality': fields.char('Quality', size=16),
- }
-travel_hostel()
-
-class travel_airport(osv.osv):
- _name = 'travel.airport'
- _columns = {
- 'name': fields.char('Airport name', size=16),
- 'city': fields.char('City', size=16),
- 'country': fields.many2one('res.country', 'Country')
- }
-travel_airport()
-
-class travel_room(osv.osv):
- _name = 'travel.room'
- _inherit = 'product.product'
- _table = 'product_product'
- _columns = {
- 'beds': fields.integer('Nbr of Beds'),
- 'view': fields.selection([('sea','Sea'),('street','Street')], 'Room View'),
- 'hostel_id': fields.many2one('travel.hostel', 'Hostel'),
- }
-travel_room()
-class travel_flight(osv.osv):
- _name = 'travel.flight'
- _inherit = 'product.product'
- _table = 'product_product'
- _columns = {
- 'partner_id': fields.many2one('res.partner', 'PArtner'),
- 'date': fields.datetime('Departure Date'),
- 'airport_from': fields.many2one('travel.airport', 'Airport Departure'),
- 'airport_to': fields.many2one('travel.airport', 'Airport Arrival'),
- }
-travel_flight()
-
diff --git a/addons/travel/custom_report.xml b/addons/travel/custom_report.xml
deleted file mode 100644
index dcda3e67591..00000000000
--- a/addons/travel/custom_report.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <report
- string="Custom Ticket"
- model="travel.flight"
- name="travel flight"
- rml="travel/ticket.rml"
- />
- </data>
-</terp>
diff --git a/addons/travel/custom_view.xml b/addons/travel/custom_view.xml
deleted file mode 100644
index 511ef35dc00..00000000000
--- a/addons/travel/custom_view.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<terp>
-<data>
- <record model="ir.actions.act_window" id="action_travel_hostel_form">
- <field name="res_model">travel.hostel</field>
- <field name="domain">[]</field>
- </record>
- <menuitem name="Travel Agency/Hostels" id="menu_travel_hostel_form" action="action_travel_hostel_form"/>
-
- <record model="ir.actions.act_window" id="action_travel_room_form">
- <field name="res_model">travel.room</field>
- </record>
- <menuitem name="Travel Agency/Rooms" id="menu_travel_room_form" action="action_travel_room_form"/>
-
- <record model="ir.actions.act_window" id="action_travel_hostel_form2">
- <field name="name">Single rooms</field>
- <field name="res_model">travel.hostel</field>
- <field name="domain">[('beds','=',1)]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Travel Agency/Rooms/Single Rooms" id="menu_travel_hostel_form2" action="action_travel_hostel_form2"/>
-
- <record model="ir.actions.act_window" id="action_travel_hostel_form3">
- <field name="name">Double rooms</field>
- <field name="res_model">travel.room</field>
- <field name="domain">[('beds','=',2)]</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
- <menuitem name="Travel Agency/Rooms/Double Rooms" id="menu_travel_hostel_form3" action="action_travel_hostel_form3"/>
-
- <record model="ir.actions.act_window" id="action_travel_airport_form">
- <field name="res_model">travel.airport</field>
- </record>
- <menuitem name="Travel Agency/Airports" id="menu_travel_airport_form" action="action_travel_airport_form"/>
-
- <record model="ir.actions.act_window" id="action_travel_flight_form">
- <field name="res_model">travel.flight</field>
- <field name="domain">[]</field>
- </record>
- <menuitem name="Travel Agency/Flights" id="menu_travel_flight_form" action="action_travel_flight_form"/>
-
- <record model="ir.ui.view" id="view_travel_flight_form">
- <field name="name">travel.flight</field>
- <field name="model">travel.flight</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Flight">
- <field name="name" select="1"/>
- <field name="partner_id" select="1" />
- <field name="date" select="1" />
- <field name="categ_id" select="1" />
- <field name="airport_from" select="1" />
- <field name="airport_to" select="1" />
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_travel_room_form">
- <field name="name">travel.room</field>
- <field name="model">travel.room</field>
- <field name="type">form</field>
- <field name="priority" eval="5"/>
- <field name="arch" type="xml">
- <form string="Room">
- <field name="name" select="1"/>
- <field name="categ_id" select="1" />
- <field name="beds" select="1" />
- <field name="view" select="1" />
- <field name="list_price" select="1" />
- <field name="standard_price" select="1" />
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_travel_room_tree">
- <field name="name">travel.room</field>
- <field name="model">travel.room</field>
- <field name="type">tree</field>
- <field name="priority" eval="5"/>
- <field name="arch" type="xml">
- <tree string="Room">
- <field name="name" select="1"/>
- <field name="view" select="1" />
- <field name="list_price" select="1" />
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_travel_hostel_form">
- <field name="name">travel.hostel</field>
- <field name="model">travel.hostel</field>
- <field name="type">form</field>
- <field name="priority" eval="5"/>
- <field name="arch" type="xml">
- <form string="Hostel">
- <notebook>
- <page string="General">
- <separator string="Hostel Information" colspan="4"/>
- <field name="name" select="1"/>
- <field name="lang" select="1"/>
- <newline/>
- <field name="address" mode="form,tree" colspan="4" nolabel="1" select="1"/>
- <separator string="Categories" colspan="4"/>
- <field name="category_id" colspan="4" select="1" nolabel="1"/>
- </page>
- <page string="Rooms Info">
- <field name="rooms_id" colspan="4" widget="one2many_list"
- nolabel="1"/>
- </page>
- <page string="Event History">
- <field name="comment" colspan="4" nolabel="1"/>
- <field name="events" colspan="4" nolabel="1" widget="one2many_list"/>
- </page>
- </notebook>
- </form>
- </field>
- </record>
-</data>
-</terp>
-
diff --git a/addons/travel/ticket.rml b/addons/travel/ticket.rml
deleted file mode 100644
index 5f9a409b55b..00000000000
--- a/addons/travel/ticket.rml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="GRID" colorName="black"/>
- <blockBackground colorName="#ffff66" start="0,0" stop="0,0"/>
- <blockBackground colorName="#c0c0c0" start="0,1" stop="0,1"/>
- <blockBackground colorName="#c0c0c0" start="1,1" stop="1,1"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Times-Roman" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P2" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P3" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Standard" fontName="Times-Roman"/>
- <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Times-Roman"/>
- </stylesheet>
- <story>
- <section>
- <para style="Standard">[[ objects.repeatIn('o') ]]</para>
- <blockTable colWidths="241.0,241.0" style="Tableau1">
- <tr>
- <td>
- <para style="P1">Flight Ticket [[ o.id ]]</para>
- <para style="Table Contents">[[ o.name ]]</para>
- <para style="Table Contents">TO: [[ o.partner_id.name ]]</para>
- <para style="Table Contents">ADDRESS: [[o.partner_id.name ]]</para>
- </td>
- <td>
- <illustration height="56.0" width="75.0">
- <image x="0" y="0" file="10000000000000640000004BDD3CD5AB.gif" height="56.0" width="75.0"/>
- </illustration>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P2">DEPARTURE</para>
- <para style="P3">[[ o.airport_from.name ]]</para>
- <para style="P3">[[ o.airport_from.country.name ]]</para>
- </td>
- <td>
- <para style="P2">ARRIVAL</para>
- <para style="P3">[[ o.airport_to.name]]</para>
- <para style="P3">[[ o.airport_to.country.name ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </section>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </story>
-</document>
-
diff --git a/addons/users_ldap/__init__.py b/addons/users_ldap/__init__.py
deleted file mode 100644
index 8a12325a454..00000000000
--- a/addons/users_ldap/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import users_ldap
diff --git a/addons/users_ldap/__terp__.py b/addons/users_ldap/__terp__.py
deleted file mode 100644
index 54aa633e89d..00000000000
--- a/addons/users_ldap/__terp__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name" : "Authenticate users with ldap server",
- "version" : "0.1",
- "depends" : ["base"],
- "author" : "Tiny",
- "description": """Add support for authentication by ldap server""",
- "website" : "http://tinyerp.com/",
- "category" : "Generic Modules/Others",
- "init_xml" : [
- ],
- "demo_xml" : [
- ],
- "update_xml" : [
- "users_ldap_view.xml",
- ],
- "active": False,
- "installable": True
-}
diff --git a/addons/users_ldap/users_ldap.py b/addons/users_ldap/users_ldap.py
deleted file mode 100644
index 7114bd41f64..00000000000
--- a/addons/users_ldap/users_ldap.py
+++ /dev/null
@@ -1,140 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from osv import fields,osv
-from service import security
-import pooler
-
-try:
- import ldap
-except ImportError:
- import netsvc
- logger = netsvc.Logger()
- logger.notifyChannel("init", netsvc.LOG_WARNING, "could not import ldap!")
-
-class res_company(osv.osv):
- _inherit = "res.company"
-
- _columns = {
- 'ldap_server': fields.char('LDAP Server address', size=64),
- 'ldap_binddn': fields.char('LDAP binddn', size=64),
- 'ldap_password': fields.char('LDAP password', size=64),
- 'ldap_filter': fields.char('LDAP filter', size=64),
- 'ldap_base': fields.char('LDAP base', size=64),
- }
-res_company()
-
-def ldap_login(oldfnc):
- def _ldap_login(db, login, passwd):
- cr = pooler.get_db(db).cursor()
- module_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
- module_ids = module_obj.search(cr, 1, [('name', '=', 'users_ldap')])
- if module_ids:
- state = module_obj.read(cr, 1, module_ids, ['state'])[0]['state']
- if state in ('installed', 'to upgrade', 'to remove'):
- cr.execute("select id, name, ldap_server, ldap_binddn, ldap_password, ldap_filter, ldap_base from res_company where ldap_server != '' and ldap_binddn != ''")
- for res_company in cr.dictfetchall():
- try:
- l = ldap.open(res_company['ldap_server'])
- if l.simple_bind_s(res_company['ldap_binddn'], res_company['ldap_password']):
- base = res_company['ldap_base']
- scope = ldap.SCOPE_SUBTREE
- filter = res_company['ldap_filter']%(login,)
- retrieve_attributes = None
- result_id = l.search(base, scope, filter, retrieve_attributes)
- timeout = 60
- result_type, result_data = l.result(result_id, timeout)
- if not result_data:
- continue
- if result_type == ldap.RES_SEARCH_RESULT and len(result_data) == 1:
- dn=result_data[0][0]
- name=result_data[0][1]['cn'][0]
- if l.bind_s(dn, passwd):
- l.unbind()
- cr.execute("select id from res_users where login=%s",(login.encode('utf-8'),))
- res = cr.fetchone()
- if res:
- cr.close()
- return res[0]
- users_obj = pooler.get_pool(cr.dbname).get('res.users')
- action_obj = pooler.get_pool(cr.dbname).get('ir.actions.actions')
- action_id = action_obj.search(cr, 1, [('usage', '=', 'menu')])[0]
- res = users_obj.create(cr, 1, {'name': name, 'login': login.encode('utf-8'), 'company_id': res_company['id'], 'action_id': action_id})
- cr.commit()
- cr.close()
- return res
- l.unbind()
- except Exception, e:
- continue
- cr.close()
- return oldfnc(db, login, passwd)
- return _ldap_login
-
-security.login = ldap_login(security.login)
-
-def ldap_check(oldfnc):
- def _ldap_check(db, uid, passwd):
- if security._uid_cache.has_key(uid) and (security._uid_cache[uid]==passwd):
- return True
- cr = pooler.get_db(db).cursor()
- module_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
- module_ids = module_obj.search(cr, 1, [('name', '=', 'users_ldap')])
- if module_ids:
- state = module_obj.read(cr, 1, module_ids, ['state'])[0]['state']
- if state in ('installed', 'to upgrade', 'to remove'):
- users_obj = pooler.get_pool(cr.dbname).get('res.users')
- user = users_obj.browse(cr, 1, uid)
- if user and user.company_id.ldap_server and user.company_id.ldap_binddn:
- company = user.company_id
- try:
- l = ldap.open(company.ldap_server)
- if l.simple_bind_s(company.ldap_binddn, company.ldap_password):
- base = company['ldap_base']
- scope = ldap.SCOPE_SUBTREE
- filter = company['ldap_filter']%(user.login,)
- retrieve_attributes = None
- result_id = l.search(base, scope, filter, retrieve_attributes)
- timeout = 60
- result_type, result_data = l.result(result_id, timeout)
- if result_data and result_type == ldap.RES_SEARCH_RESULT and len(result_data) == 1:
- dn=result_data[0][0]
- name=result_data[0][1]['cn']
- if l.bind_s(dn, passwd):
- l.unbind()
- security._uid_cache[uid] = passwd
- cr.close()
- return True
- l.unbind()
- except Exception, e:
- pass
- cr.close()
- return oldfnc(db, uid, passwd)
- return _ldap_check
-
-security.check = ldap_check(security.check)
diff --git a/addons/users_ldap/users_ldap_view.xml b/addons/users_ldap/users_ldap_view.xml
deleted file mode 100644
index d8ce175bca1..00000000000
--- a/addons/users_ldap/users_ldap_view.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<terp>
- <data>
- <record model="ir.ui.view" id="company_form_view">
- <field name="name">res.company.form.inherit.users_ldap</field>
- <field name="model">res.company</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="base.view_company_form"/>
- <field name="arch" type="xml">
- <field name="rml_footer2" position="after">
- <field name="ldap_filter"/>
- <field name="ldap_base"/>
- <field name="ldap_password"/>
- <field name="ldap_binddn"/>
- <newline/>
- <field name="ldap_server"/>
- <newline/>
- </field>
- </field>
- </record>
- </data>
-</terp>