Download FV asDocument from E5 CRM; E-Commerce: fix rewizor encoding
This commit is contained in:
@@ -67,6 +67,13 @@ class Document extends SugarBean {
|
||||
var $related_doc_rev_number;
|
||||
var $is_template;
|
||||
var $template_type;
|
||||
var $payment_date;
|
||||
var $transaction_type;
|
||||
var $document_type;
|
||||
var $value;
|
||||
var $left_paid;
|
||||
var $currency_id;
|
||||
var $document_number;
|
||||
//additional fields.
|
||||
var $revision;
|
||||
var $last_rev_create_date;
|
||||
@@ -354,6 +361,7 @@ class Document extends SugarBean {
|
||||
$return_array [] = $w;
|
||||
}
|
||||
$json = getJSONobj();
|
||||
var_dump($return_array);
|
||||
return $array ? $return_array : $json->encode($return_array);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
if (! defined('sugarEntry') || ! sugarEntry)
|
||||
die('Not A Valid Entry Point');
|
||||
/**
|
||||
* *******************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
@@ -38,459 +38,463 @@ if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
* "Powered by SugarCRM".
|
||||
* ******************************************************************************
|
||||
*/
|
||||
$dictionary ['Document'] = array (
|
||||
'table' => 'documents',
|
||||
'fields' => array (
|
||||
|
||||
// add mz
|
||||
'value' => array (
|
||||
'name' => 'value',
|
||||
'vname' => 'LBL_VALUE',
|
||||
'type' => 'varchar',
|
||||
'required'=>true,
|
||||
|
||||
),
|
||||
'left_paid' => array (
|
||||
'name' => 'left_paid',
|
||||
'vname' => 'LBL_VALUE_PAID',
|
||||
'type' => 'varchar',
|
||||
|
||||
),
|
||||
'parent_type' => array (
|
||||
'name' => 'parent_type',
|
||||
'vname' => 'LBL_PARENT_NAME',
|
||||
'type' => 'varchar',
|
||||
'source' => 'non-db',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
'len' => '25',
|
||||
'comment' => 'The Sugar object to which the call is related'
|
||||
),
|
||||
'currency_id' => array (
|
||||
'name' => 'currency_id',
|
||||
'type' => 'enum',
|
||||
'options' => 'currency_dom',
|
||||
'label' => 'LBL_CURRENCY',
|
||||
'len' => 36
|
||||
),
|
||||
'document_type' => array (
|
||||
'name' => 'document_type',
|
||||
'type' => 'enum',
|
||||
'options' => 'document_type_enum',
|
||||
'default'=>'k',
|
||||
'label' => 'Typ faktury',
|
||||
'required'=>true,
|
||||
'len' => 45
|
||||
),
|
||||
'transaction_type' => array (
|
||||
'name' => 'transaction_type',
|
||||
'type' => 'enum',
|
||||
'options' => 'transaction_type3_dom',
|
||||
'size' => 3,
|
||||
'default'=>'1',
|
||||
'vname'=>'Typ transakcji',
|
||||
'label' => 'Typ transakcji',
|
||||
'required'=>true,
|
||||
'len' => 45
|
||||
),
|
||||
'currency_value' => array (
|
||||
'name' => 'currency_value',
|
||||
'type' => 'varchar',
|
||||
'vname' => 'LBL_CURRENCY_VALUE',
|
||||
'reportable' => false,
|
||||
'required' => false
|
||||
),
|
||||
'parent_name' => array (
|
||||
'name' => 'parent_name',
|
||||
|
||||
'type_name' => 'parent_type',
|
||||
'id_name' => 'parent_id',
|
||||
'vname' => 'LBL_LIST_RELATED_TO',
|
||||
'type' => 'parent',
|
||||
|
||||
'source' => 'non-db',
|
||||
'options' => 'parent_type_display2'
|
||||
),
|
||||
'corrected_document_name' => array (
|
||||
'name' => 'corrected_document_name',
|
||||
'vname' => 'Korekta do dokumentu',
|
||||
'rname'=>'document_name',
|
||||
'type' => 'varchar',
|
||||
'group' => 'corrected_document_name',
|
||||
'dbtype' => 'varchar',
|
||||
'len' => '255',
|
||||
'massupdate' => false,
|
||||
'required' => false
|
||||
),
|
||||
'parent_id' => array (
|
||||
'name' => 'parent_id',
|
||||
'type' => 'id',
|
||||
'group' => 'parent_name',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_PARENT_ID'
|
||||
),
|
||||
|
||||
'document_name' => array (
|
||||
'name' => 'document_name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'varchar',
|
||||
|
||||
'len' => '255',
|
||||
'required' => true,
|
||||
'importable' => 'required'
|
||||
),
|
||||
'name' => array (
|
||||
'name' => 'name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'source' => 'non-db',
|
||||
'type' => 'varchar'
|
||||
),
|
||||
'filename' => array (
|
||||
'name' => 'filename',
|
||||
'vname' => 'LBL_FILENAME',
|
||||
'type' => 'file',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The filename of the document attachment',
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'uploadfile' => array (
|
||||
'name' => 'uploadfile',
|
||||
'required' => false,
|
||||
'vname' => 'LBL_FILENAME',
|
||||
'type' => 'file',
|
||||
'source' => 'non-db'
|
||||
),
|
||||
|
||||
'active_date' => array (
|
||||
'name' => 'active_date',
|
||||
'vname' => 'LBL_DOC_ACTIVE_DATE',
|
||||
'type' => 'date',
|
||||
'importable' => 'required',
|
||||
'required' => true
|
||||
),
|
||||
|
||||
'exp_date' => array (
|
||||
'name' => 'exp_date',
|
||||
'vname' => 'LBL_DOC_EXP_DATE',
|
||||
'type' => 'date'
|
||||
),
|
||||
|
||||
'category_id' => array (
|
||||
'name' => 'category_id',
|
||||
'vname' => 'LBL_SF_CATEGORY',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_category_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
|
||||
'subcategory_id' => array (
|
||||
'name' => 'subcategory_id',
|
||||
'vname' => 'LBL_SF_SUBCATEGORY',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_subcategory_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
'payment_date' => array (
|
||||
'name' => 'payment_date',
|
||||
'vname' => 'LBL_PAYMENT_DATE',
|
||||
'type' => 'date',
|
||||
'reportable' => false,
|
||||
'showFormats' => true,
|
||||
'massupdate' => false,
|
||||
'required' => false
|
||||
),
|
||||
'status_id' => array (
|
||||
'name' => 'status_id',
|
||||
'vname' => 'LBL_DOC_STATUS',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_status_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
|
||||
$dictionary['Document'] = array(
|
||||
'table' => 'documents',
|
||||
'fields' => array(
|
||||
|
||||
// add mz
|
||||
'value' => array(
|
||||
'name' => 'value',
|
||||
'vname' => 'LBL_VALUE',
|
||||
'type' => 'varchar',
|
||||
'required' => true,
|
||||
|
||||
|
||||
'document_revision_id' => array (
|
||||
'name' => 'document_revision_id',
|
||||
'vname' => 'LBL_LATEST_REVISION',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'reportable' => false,
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'revisions' => array (
|
||||
'name' => 'revisions',
|
||||
'type' => 'link',
|
||||
'relationship' => 'document_revisions',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_REVISIONS',
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'revision' => array (
|
||||
'name' => 'revision',
|
||||
'vname' => 'LBL_DOC_VERSION',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'required' => true,
|
||||
'source' => 'non-db',
|
||||
'importable' => 'required',
|
||||
'required' => true
|
||||
),
|
||||
|
||||
'last_rev_created_name' => array (
|
||||
'name' => 'last_rev_created_name',
|
||||
'vname' => 'LBL_LAST_REV_CREATOR',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'last_rev_mime_type' => array (
|
||||
'name' => 'last_rev_mime_type',
|
||||
'vname' => 'LBL_LAST_REV_MIME_TYPE',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'studio' => 'false',
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'latest_revision' => array (
|
||||
'name' => 'latest_revision',
|
||||
'vname' => 'LBL_LATEST_REVISION',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'last_rev_create_date' => array (
|
||||
'name' => 'last_rev_create_date',
|
||||
'type' => 'date',
|
||||
'table' => 'document_revisions',
|
||||
'link' => 'revisions',
|
||||
'join_name' => 'document_revisions',
|
||||
'vname' => 'LBL_LAST_REV_CREATE_DATE',
|
||||
'rname' => 'date_entered',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contracts' => array (
|
||||
'name' => 'contracts',
|
||||
'type' => 'link',
|
||||
'relationship' => 'contracts_documents',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_CONTRACTS'
|
||||
),
|
||||
// todo remove
|
||||
'leads' => array (
|
||||
'name' => 'leads',
|
||||
'type' => 'link',
|
||||
'relationship' => 'leads_documents',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_LEADS'
|
||||
),
|
||||
|
||||
'related_doc_id' => array (
|
||||
'name' => 'related_doc_id',
|
||||
'vname' => 'LBL_RELATED_DOCUMENT_ID',
|
||||
'reportable' => false,
|
||||
'dbType' => 'id',
|
||||
'type' => 'varchar',
|
||||
'len' => '36'
|
||||
),
|
||||
|
||||
'related_doc_name' => array (
|
||||
'name' => 'related_doc_name',
|
||||
'vname' => 'LBL_DET_RELATED_DOCUMENT',
|
||||
'type' => 'relate',
|
||||
'table' => 'documents',
|
||||
'id_name' => 'related_doc_id',
|
||||
'module' => 'Documents',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The related document name for Meta-Data framework'
|
||||
),
|
||||
|
||||
'related_doc_rev_id' => array (
|
||||
'name' => 'related_doc_rev_id',
|
||||
'vname' => 'LBL_RELATED_DOCUMENT_REVISION_ID',
|
||||
'reportable' => false,
|
||||
'dbType' => 'id',
|
||||
'type' => 'varchar',
|
||||
'len' => '36'
|
||||
),
|
||||
|
||||
'related_doc_rev_number' => array (
|
||||
'name' => 'related_doc_rev_number',
|
||||
'vname' => 'LBL_DET_RELATED_DOCUMENT_VERSION',
|
||||
'type' => 'varchar',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The related document version number for Meta-Data framework'
|
||||
),
|
||||
|
||||
'is_template' => array (
|
||||
'name' => 'is_template',
|
||||
'vname' => 'LBL_IS_TEMPLATE',
|
||||
'type' => 'bool',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'accepted' => array (
|
||||
'name' => 'accepted',
|
||||
'vname' => 'LBL_TO_ACCEPT',
|
||||
'type' => 'enum',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'options' => 'document_user_status_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
'status' => array (
|
||||
'name' => 'status',
|
||||
'vname' => 'Status',
|
||||
'type' => 'enum',
|
||||
|
||||
'options' => 'status_user_status_dom',
|
||||
'reportable' => false,
|
||||
'required'=>true
|
||||
),
|
||||
'date_start' => array (
|
||||
'name' => 'date_start',
|
||||
'vname' => 'LBL_DATE_START',
|
||||
'type' => 'date',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'date_end' => array (
|
||||
'name' => 'date_end',
|
||||
'vname' => 'LBL_DATE_END',
|
||||
'type' => 'date',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'template_type' => array (
|
||||
'name' => 'template_type',
|
||||
'vname' => 'LBL_TEMPLATE_TYPE',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_template_type_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
// BEGIN field used for contract document subpanel.
|
||||
'latest_revision_name' => array (
|
||||
'name' => 'latest_revision_name',
|
||||
'vname' => 'LBL_LASTEST_REVISION_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
|
||||
'selected_revision_name' => array (
|
||||
'name' => 'selected_revision_name',
|
||||
'vname' => 'LBL_SELECTED_REVISION_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contract_status' => array (
|
||||
'name' => 'contract_status',
|
||||
'vname' => 'LBL_CONTRACT_STATUS',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contract_name' => array (
|
||||
'name' => 'contract_name',
|
||||
'vname' => 'LBL_CONTRACT_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'linked_id' => array (
|
||||
'name' => 'linked_id',
|
||||
'vname' => 'LBL_LINKED_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'selected_revision_id' => array (
|
||||
'name' => 'selected_revision_id',
|
||||
'vname' => 'LBL_SELECTED_REVISION_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'latest_revision_id' => array (
|
||||
'name' => 'latest_revision_id',
|
||||
'vname' => 'LBL_LATEST_REVISION_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'selected_revision_filename' => array (
|
||||
'name' => 'selected_revision_filename',
|
||||
'vname' => 'LBL_SELECTED_REVISION_FILENAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'document_date' => array (
|
||||
'name' => 'document_date',
|
||||
'vname' => 'LBL_DOCUMENT_DATE',
|
||||
'type' => 'date',
|
||||
'reportable' => false,
|
||||
'showFormats' => true,
|
||||
'massupdate' => false,
|
||||
'required' => true
|
||||
)
|
||||
// END fields used for contract documents subpanel.
|
||||
),
|
||||
|
||||
'indices' => array (
|
||||
array (
|
||||
'name' => 'idx_doc_cat',
|
||||
'type' => 'index',
|
||||
'fields' => array (
|
||||
'category_id',
|
||||
'subcategory_id'
|
||||
)
|
||||
)
|
||||
),
|
||||
'relationships' => array (
|
||||
'document_revisions' => array (
|
||||
'lhs_module' => 'Documents',
|
||||
'lhs_table' => 'documents',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'document_revisions',
|
||||
'rhs_key' => 'document_id',
|
||||
'relationship_type' => 'one-to-many'
|
||||
),
|
||||
|
||||
'documents_modified_user' => array (
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'documents',
|
||||
'rhs_key' => 'modified_user_id',
|
||||
'relationship_type' => 'one-to-many'
|
||||
),
|
||||
|
||||
'documents_created_by' => array (
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'documents',
|
||||
'rhs_key' => 'created_by',
|
||||
'relationship_type' => 'one-to-many'
|
||||
)
|
||||
)
|
||||
'left_paid' => array(
|
||||
'name' => 'left_paid',
|
||||
'vname' => 'LBL_VALUE_PAID',
|
||||
'type' => 'varchar',
|
||||
|
||||
),
|
||||
'parent_type' => array(
|
||||
'name' => 'parent_type',
|
||||
'vname' => 'LBL_PARENT_NAME',
|
||||
'type' => 'varchar',
|
||||
'source' => 'non-db',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
'len' => '25',
|
||||
'comment' => 'The Sugar object to which the call is related'
|
||||
),
|
||||
'currency_id' => array(
|
||||
'name' => 'currency_id',
|
||||
'type' => 'enum',
|
||||
'options' => 'currency_dom',
|
||||
'label' => 'LBL_CURRENCY',
|
||||
'len' => 36
|
||||
),
|
||||
'document_type' => array(
|
||||
'name' => 'document_type',
|
||||
'type' => 'enum',
|
||||
'options' => 'document_type_enum',
|
||||
'default' => 'k',
|
||||
'label' => 'Typ faktury',
|
||||
'required' => true,
|
||||
'len' => 45
|
||||
),
|
||||
'transaction_type' => array(
|
||||
'name' => 'transaction_type',
|
||||
'type' => 'enum',
|
||||
'options' => 'transaction_type3_dom',
|
||||
'size' => 3,
|
||||
'default' => '1',
|
||||
'vname' => 'Typ transakcji',
|
||||
'label' => 'Typ transakcji',
|
||||
'required' => true,
|
||||
'len' => 45
|
||||
),
|
||||
'currency_value' => array(
|
||||
'name' => 'currency_value',
|
||||
'type' => 'varchar',
|
||||
'vname' => 'LBL_CURRENCY_VALUE',
|
||||
'reportable' => false,
|
||||
'required' => false
|
||||
),
|
||||
'parent_name' => array(
|
||||
'name' => 'parent_name',
|
||||
|
||||
'type_name' => 'parent_type',
|
||||
'id_name' => 'parent_id',
|
||||
'vname' => 'LBL_LIST_RELATED_TO',
|
||||
'type' => 'parent',
|
||||
|
||||
'source' => 'non-db',
|
||||
'options' => 'parent_type_display2'
|
||||
),
|
||||
'corrected_document_name' => array(
|
||||
'name' => 'corrected_document_name',
|
||||
'vname' => 'Korekta do dokumentu',
|
||||
'rname' => 'document_name',
|
||||
'type' => 'varchar',
|
||||
'group' => 'corrected_document_name',
|
||||
'dbtype' => 'varchar',
|
||||
'len' => '255',
|
||||
'massupdate' => false,
|
||||
'required' => false
|
||||
),
|
||||
'parent_id' => array(
|
||||
'name' => 'parent_id',
|
||||
'type' => 'id',
|
||||
'group' => 'parent_name',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_PARENT_ID'
|
||||
),
|
||||
|
||||
'document_name' => array(
|
||||
'name' => 'document_name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'varchar',
|
||||
|
||||
'len' => '255',
|
||||
'required' => true,
|
||||
'importable' => 'required'
|
||||
),
|
||||
'document_number' => array(
|
||||
'name' => 'document_name',
|
||||
'type' => 'varchar',
|
||||
'len' => '45',
|
||||
),
|
||||
'name' => array(
|
||||
'name' => 'name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'source' => 'non-db',
|
||||
'type' => 'varchar'
|
||||
),
|
||||
'filename' => array(
|
||||
'name' => 'filename',
|
||||
'vname' => 'LBL_FILENAME',
|
||||
'type' => 'file',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The filename of the document attachment',
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'uploadfile' => array(
|
||||
'name' => 'uploadfile',
|
||||
'required' => false,
|
||||
'vname' => 'LBL_FILENAME',
|
||||
'type' => 'file',
|
||||
'source' => 'non-db'
|
||||
),
|
||||
|
||||
'active_date' => array(
|
||||
'name' => 'active_date',
|
||||
'vname' => 'LBL_DOC_ACTIVE_DATE',
|
||||
'type' => 'date',
|
||||
'importable' => 'required',
|
||||
'required' => true
|
||||
),
|
||||
|
||||
'exp_date' => array(
|
||||
'name' => 'exp_date',
|
||||
'vname' => 'LBL_DOC_EXP_DATE',
|
||||
'type' => 'date'
|
||||
),
|
||||
|
||||
'category_id' => array(
|
||||
'name' => 'category_id',
|
||||
'vname' => 'LBL_SF_CATEGORY',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_category_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
|
||||
'subcategory_id' => array(
|
||||
'name' => 'subcategory_id',
|
||||
'vname' => 'LBL_SF_SUBCATEGORY',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_subcategory_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
'payment_date' => array(
|
||||
'name' => 'payment_date',
|
||||
'vname' => 'LBL_PAYMENT_DATE',
|
||||
'type' => 'date',
|
||||
'reportable' => false,
|
||||
'showFormats' => true,
|
||||
'massupdate' => false,
|
||||
'required' => false
|
||||
),
|
||||
'status_id' => array(
|
||||
'name' => 'status_id',
|
||||
'vname' => 'LBL_DOC_STATUS',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_status_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
|
||||
|
||||
|
||||
'document_revision_id' => array(
|
||||
'name' => 'document_revision_id',
|
||||
'vname' => 'LBL_LATEST_REVISION',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'reportable' => false,
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'revisions' => array(
|
||||
'name' => 'revisions',
|
||||
'type' => 'link',
|
||||
'relationship' => 'document_revisions',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_REVISIONS',
|
||||
'required' => false
|
||||
),
|
||||
|
||||
'revision' => array(
|
||||
'name' => 'revision',
|
||||
'vname' => 'LBL_DOC_VERSION',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'required' => true,
|
||||
'source' => 'non-db',
|
||||
'importable' => 'required',
|
||||
'required' => true
|
||||
),
|
||||
|
||||
'last_rev_created_name' => array(
|
||||
'name' => 'last_rev_created_name',
|
||||
'vname' => 'LBL_LAST_REV_CREATOR',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'last_rev_mime_type' => array(
|
||||
'name' => 'last_rev_mime_type',
|
||||
'vname' => 'LBL_LAST_REV_MIME_TYPE',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'studio' => 'false',
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'latest_revision' => array(
|
||||
'name' => 'latest_revision',
|
||||
'vname' => 'LBL_LATEST_REVISION',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'last_rev_create_date' => array(
|
||||
'name' => 'last_rev_create_date',
|
||||
'type' => 'date',
|
||||
'table' => 'document_revisions',
|
||||
'link' => 'revisions',
|
||||
'join_name' => 'document_revisions',
|
||||
'vname' => 'LBL_LAST_REV_CREATE_DATE',
|
||||
'rname' => 'date_entered',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contracts' => array(
|
||||
'name' => 'contracts',
|
||||
'type' => 'link',
|
||||
'relationship' => 'contracts_documents',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_CONTRACTS'
|
||||
),
|
||||
// todo remove
|
||||
'leads' => array(
|
||||
'name' => 'leads',
|
||||
'type' => 'link',
|
||||
'relationship' => 'leads_documents',
|
||||
'source' => 'non-db',
|
||||
'vname' => 'LBL_LEADS'
|
||||
),
|
||||
|
||||
'related_doc_id' => array(
|
||||
'name' => 'related_doc_id',
|
||||
'vname' => 'LBL_RELATED_DOCUMENT_ID',
|
||||
'reportable' => false,
|
||||
'dbType' => 'id',
|
||||
'type' => 'varchar',
|
||||
'len' => '36'
|
||||
),
|
||||
|
||||
'related_doc_name' => array(
|
||||
'name' => 'related_doc_name',
|
||||
'vname' => 'LBL_DET_RELATED_DOCUMENT',
|
||||
'type' => 'relate',
|
||||
'table' => 'documents',
|
||||
'id_name' => 'related_doc_id',
|
||||
'module' => 'Documents',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The related document name for Meta-Data framework'
|
||||
),
|
||||
|
||||
'related_doc_rev_id' => array(
|
||||
'name' => 'related_doc_rev_id',
|
||||
'vname' => 'LBL_RELATED_DOCUMENT_REVISION_ID',
|
||||
'reportable' => false,
|
||||
'dbType' => 'id',
|
||||
'type' => 'varchar',
|
||||
'len' => '36'
|
||||
),
|
||||
|
||||
'related_doc_rev_number' => array(
|
||||
'name' => 'related_doc_rev_number',
|
||||
'vname' => 'LBL_DET_RELATED_DOCUMENT_VERSION',
|
||||
'type' => 'varchar',
|
||||
'source' => 'non-db',
|
||||
'comment' => 'The related document version number for Meta-Data framework'
|
||||
),
|
||||
|
||||
'is_template' => array(
|
||||
'name' => 'is_template',
|
||||
'vname' => 'LBL_IS_TEMPLATE',
|
||||
'type' => 'bool',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'accepted' => array(
|
||||
'name' => 'accepted',
|
||||
'vname' => 'LBL_TO_ACCEPT',
|
||||
'type' => 'enum',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'options' => 'document_user_status_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
'status' => array(
|
||||
'name' => 'status',
|
||||
'vname' => 'Status',
|
||||
'type' => 'enum',
|
||||
|
||||
'options' => 'status_user_status_dom',
|
||||
'reportable' => false,
|
||||
'required' => true
|
||||
),
|
||||
'date_start' => array(
|
||||
'name' => 'date_start',
|
||||
'vname' => 'LBL_DATE_START',
|
||||
'type' => 'date',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'date_end' => array(
|
||||
'name' => 'date_end',
|
||||
'vname' => 'LBL_DATE_END',
|
||||
'type' => 'date',
|
||||
'source' => 'non-db',
|
||||
'default' => 0,
|
||||
'reportable' => false
|
||||
),
|
||||
'template_type' => array(
|
||||
'name' => 'template_type',
|
||||
'vname' => 'LBL_TEMPLATE_TYPE',
|
||||
'type' => 'enum',
|
||||
'len' => '25',
|
||||
'options' => 'document_template_type_dom',
|
||||
'reportable' => false
|
||||
),
|
||||
// BEGIN field used for contract document subpanel.
|
||||
'latest_revision_name' => array(
|
||||
'name' => 'latest_revision_name',
|
||||
'vname' => 'LBL_LASTEST_REVISION_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
|
||||
'selected_revision_name' => array(
|
||||
'name' => 'selected_revision_name',
|
||||
'vname' => 'LBL_SELECTED_REVISION_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contract_status' => array(
|
||||
'name' => 'contract_status',
|
||||
'vname' => 'LBL_CONTRACT_STATUS',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'contract_name' => array(
|
||||
'name' => 'contract_name',
|
||||
'vname' => 'LBL_CONTRACT_NAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'linked_id' => array(
|
||||
'name' => 'linked_id',
|
||||
'vname' => 'LBL_LINKED_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'selected_revision_id' => array(
|
||||
'name' => 'selected_revision_id',
|
||||
'vname' => 'LBL_SELECTED_REVISION_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'latest_revision_id' => array(
|
||||
'name' => 'latest_revision_id',
|
||||
'vname' => 'LBL_LATEST_REVISION_ID',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'selected_revision_filename' => array(
|
||||
'name' => 'selected_revision_filename',
|
||||
'vname' => 'LBL_SELECTED_REVISION_FILENAME',
|
||||
'type' => 'varchar',
|
||||
'reportable' => false,
|
||||
'source' => 'non-db'
|
||||
),
|
||||
'document_date' => array(
|
||||
'name' => 'document_date',
|
||||
'vname' => 'LBL_DOCUMENT_DATE',
|
||||
'type' => 'date',
|
||||
'reportable' => false,
|
||||
'showFormats' => true,
|
||||
'massupdate' => false,
|
||||
'required' => true
|
||||
)
|
||||
// END fields used for contract documents subpanel.
|
||||
),
|
||||
|
||||
'indices' => array(
|
||||
array(
|
||||
'name' => 'idx_doc_cat',
|
||||
'type' => 'index',
|
||||
'fields' => array(
|
||||
'category_id',
|
||||
'subcategory_id'
|
||||
)
|
||||
)
|
||||
),
|
||||
'relationships' => array(
|
||||
'document_revisions' => array(
|
||||
'lhs_module' => 'Documents',
|
||||
'lhs_table' => 'documents',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'document_revisions',
|
||||
'rhs_key' => 'document_id',
|
||||
'relationship_type' => 'one-to-many'
|
||||
),
|
||||
|
||||
'documents_modified_user' => array(
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'documents',
|
||||
'rhs_key' => 'modified_user_id',
|
||||
'relationship_type' => 'one-to-many'
|
||||
),
|
||||
|
||||
'documents_created_by' => array(
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Documents',
|
||||
'rhs_table' => 'documents',
|
||||
'rhs_key' => 'created_by',
|
||||
'relationship_type' => 'one-to-many'
|
||||
)
|
||||
)
|
||||
);
|
||||
VardefManager::createVardef ( 'Documents', 'Document', array (
|
||||
'default'
|
||||
) );
|
||||
?>
|
||||
VardefManager::createVardef('Documents', 'Document', array(
|
||||
'default'
|
||||
));
|
||||
|
||||
@@ -104,6 +104,8 @@ src="modules/Documents/js/Documents13.js"></script><input type="hidden" id="dbas
|
||||
if(strtotime($this->bean->date_entered.'+1 hours')<strtotime("now")){
|
||||
// die('Brak możliwości edycji');
|
||||
}
|
||||
var_dump("TREST");
|
||||
var_dump($this->bean->vats);
|
||||
} else {
|
||||
global $timedate;
|
||||
$format = $timedate->get_cal_date_format();
|
||||
|
||||
@@ -24,22 +24,46 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
function exportToRewizor(source, date, type) {
|
||||
if (type == undefined || type == null || type == "") {
|
||||
alert("Wybierz rodzaj faktur (normalne lub korekty).");
|
||||
return;
|
||||
}
|
||||
if (source == undefined || source == null || source == "") {
|
||||
alert("Wybierz źródło faktur.");
|
||||
return;
|
||||
}
|
||||
|
||||
blockUI("Trwa generowanie pliku...");
|
||||
$.ajax({
|
||||
url: "index.php?module=EcmInvoiceOuts&action=ecommerce&ajax=exportToRewizor&to_pdf=1&source="+source+"&date="+date+"&type="+type,
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', "index.php?module=EcmInvoiceOuts&action=ecommerce&ajax=exportToRewizor&to_pdf=1&source="+source+"&date="+date+"&type="+type, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200) {
|
||||
var arrayBuffer = xhr.response;
|
||||
var bytes = new Uint8Array(arrayBuffer);
|
||||
var data = '';
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
data += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
|
||||
data = data.replace(/ {4}/g, "");
|
||||
data = data.replace(/\n/g, "\r\n");
|
||||
var bytes = new TextEncoder("windows-1252", { NONSTANDARD_allowLegacyEncoding: true }).encode(data);
|
||||
var filename = "rewizor-allegro.epp";
|
||||
var blob = new Blob([bytes], { type: "text/csv"});
|
||||
|
||||
var finalBytes = new Uint8Array(data.length);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
finalBytes[i] = data.charCodeAt(i) & 0xFF;
|
||||
}
|
||||
|
||||
var filename = `rewizor-${source}-${type}.epp`;
|
||||
var blob = new Blob([finalBytes], { type: "text/plain;charset=iso-8859-2"});
|
||||
|
||||
if (navigator.msSaveBlob) { // IE 10+
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
} else {
|
||||
var link = document.createElement("a");
|
||||
if (link.download !== undefined) { // feature detection
|
||||
// Browsers that support HTML5 download attribute
|
||||
var url = URL.createObjectURL(blob);
|
||||
link.setAttribute("href", url);
|
||||
link.setAttribute("download", filename);
|
||||
@@ -48,16 +72,21 @@ function exportToRewizor(source, date, type) {
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
$.unblockUI();
|
||||
}
|
||||
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function () {
|
||||
|
||||
} else {
|
||||
window.alert("Błąd eksportu.");
|
||||
$.unblockUI();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
window.alert("Błąd eksportu.");
|
||||
$.unblockUI();
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function blockUI($msg) {
|
||||
|
||||
@@ -53,14 +53,20 @@ function show()
|
||||
function getInvoices($source, $date, $type)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
if ($source =='') $source = '%';
|
||||
$date .= '%';
|
||||
$query = "SELECT i.*, wz.document_no AS wz_document_no, wz.id AS wz_id FROM ecommerce_invoices AS i
|
||||
LEFT JOIN ecmstockdocouts AS wz on wz.id = i.ecmstockdocout_id
|
||||
";
|
||||
$query .= " WHERE i.origin LIKE '$source' AND i.register_date LIKE '$date'";
|
||||
if ($type !='') {
|
||||
$query.=" AND i.type='$type'";
|
||||
$query .= " WHERE i.register_date LIKE '$date'";
|
||||
if ($source != '') {
|
||||
if ($source == 'baselinker') {
|
||||
$query .= " AND i.origin IN ('allegro', 'shop')";
|
||||
} else {
|
||||
$query .= " AND i.origin = '$source'";
|
||||
}
|
||||
}
|
||||
if ($type != '') {
|
||||
$query .= " AND i.type='$type'";
|
||||
}
|
||||
$query .= " ORDER BY i.register_date";
|
||||
$result = $db->query($query);
|
||||
@@ -99,10 +105,11 @@ function getDates()
|
||||
function getSources() {
|
||||
$db = $GLOBALS['db'];
|
||||
$sources = array();
|
||||
$res = $db->query("SELECT DISTINCT origin FROM ecommerce_invoices");
|
||||
$res = $db->query("SELECT DISTINCT origin FROM ecommerce_invoices WHERE origin NOT IN ('allegro', 'shop')");
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$sources[]= $row['origin'];
|
||||
}
|
||||
$sources[] = 'baselinker';
|
||||
return $sources;
|
||||
}
|
||||
|
||||
@@ -125,14 +132,13 @@ function exportToRewizor($source, $date, $type)
|
||||
}
|
||||
|
||||
$smarty->assign("data", $invoices);
|
||||
$result = '';
|
||||
if ($type == 'normal') {
|
||||
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor.tpl');
|
||||
$result = $smarty->fetch(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor.tpl');
|
||||
} else {
|
||||
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor_fvkor.tpl');
|
||||
$result = $smarty->fetch(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor_fvkor.tpl');
|
||||
}
|
||||
// encode result as ansi
|
||||
echo $result;
|
||||
//echo mb_convert_encoding($result, 'ANSI', 'UTF-8');
|
||||
echo mb_convert_encoding($result, 'ISO-8859-2', 'UTF-8');
|
||||
}
|
||||
|
||||
function brecho($var)
|
||||
|
||||
@@ -165,6 +165,8 @@ class EcmProduct extends SugarBean {
|
||||
var $position_list;
|
||||
var $th;
|
||||
var $ean;
|
||||
var $position_list3;
|
||||
var $modified_user_name;
|
||||
// RELATED FIELDS
|
||||
var $created_by;
|
||||
var $created_by_name;
|
||||
|
||||
@@ -14,7 +14,8 @@ class PurchaseCreator{
|
||||
}
|
||||
|
||||
public function getPurchases($type){
|
||||
$query="select * from documents where document_date>='" . $this->date_from . "' and document_date<='" . $this->date_to . "' and category_id in ('invoice','compain_note','return_note') and deleted=0";
|
||||
//$query = "SELECT * FROM documents WHERE id='790f2a4d-28d7-e135-9be2-68408ca7279a'";
|
||||
//$query="select * from documents where document_date>='" . $this->date_from . "' and document_date<='" . $this->date_to . "' and category_id in ('invoice','compain_note','return_note') and deleted=0";
|
||||
if ($type == "new") {
|
||||
$query .= " and exported = 0";
|
||||
}
|
||||
|
||||
@@ -148,6 +148,7 @@ class EcmSale extends SugarBean {
|
||||
var $pdf_type;
|
||||
var $pdf_text;
|
||||
var $ecommerce_invoices;
|
||||
var $vats_summary;
|
||||
// SUBPANELS RELATED
|
||||
// MODULE OBJECT DETAILS
|
||||
var $module_dir = "EcmSales";
|
||||
|
||||
@@ -77,6 +77,28 @@ class EcmStockDocIn extends SugarBean {
|
||||
var $stock_id;
|
||||
var $parent_id;
|
||||
var $parent_name;
|
||||
var $parent_address_street;
|
||||
var $parent_address_postalcode;
|
||||
var $parent_address_city;
|
||||
var $parent_address_country;
|
||||
var $parent_nip;
|
||||
var $status;
|
||||
var $kind;
|
||||
var $total_netto;
|
||||
var $total_brutto;
|
||||
var $canceled;
|
||||
var $country_transport_val;
|
||||
var $foreign_transport_val;
|
||||
var $foreign_transport_cur_id;
|
||||
var $country_transport_cur_id;
|
||||
var $addition_cost_val;
|
||||
var $addition_cost_cur_id;
|
||||
var $currency_id;
|
||||
var $currency_value;
|
||||
var $currency_sad_value;
|
||||
var $vats_summary;
|
||||
var $date_fk;
|
||||
var $fromREST;
|
||||
// SUBPANELS RELATED
|
||||
// MODULE OBJECT DETAILS
|
||||
var $module_dir = "EcmStockDocIns";
|
||||
|
||||
Reference in New Issue
Block a user