Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
global $current_user;
$dashletData['MyEcmStocksDashlet']['searchFields'] = array(
'date_entered' => array('default' => ''),
'date_modified' => array('default' => ''),
'assigned_user_id' => array('type' => 'assigned_user_name',
'default' => $current_user->name)
);
$dashletData['MyEcmStocksDashlet']['columns'] = array(
'name' => array(
'width' => '40',
'label' => 'LBL_LIST_NAME',
'link' => true,
'default' => true),
'date_entered' => array(
'width' => '15',
'label' => 'LBL_DATE_ENTERED'),
'date_modified' => array(
'width' => '15',
'label' => 'LBL_DATE_MODIFIED'),
'created_by' => array(
'width' => '8',
'label' => 'LBL_CREATED'),
'assigned_user_name' => array(
'width' => '8',
'label' => 'LBL_LIST_ASSIGNED_USER'),
);
?>

View File

@@ -0,0 +1,59 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
global $app_strings;
$dashletMeta['MyEcmStocksDashlet'] = array(
'title' => translate('LBL_LIST_MY_ECMSTOCKS', 'EcmStocks'),
'icon' => 'modules/EcmStocks/images/EcmStocks.gif',
'description' => 'A customizable view into EcmStocks',
'category' => 'Module Views'
);
?>

View File

@@ -0,0 +1,75 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('include/Dashlets/DashletGeneric.php');
require_once('modules/EcmStocks/EcmStock.php');
require_once('modules/EcmStocks/Dashlets/MyEcmStocksDashlets/MyEcmStocksDashlet.data.php');
class MyEcmStocksDashlet extends DashletGeneric {
function MyEcmStocksDashlet($id, $def = null) {
global $current_user, $app_strings, $dashletData;
parent::DashletGeneric($id, $def);
$this->searchFields = $dashletData['MyEcmStocksDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmStocksDashlet']['columns'];
if(empty($def['title']))
$this->title = translate('LBL_LIST_MY_ECMSTOCKS', 'EcmStocks');
$this->seedBean = new EcmStock();
}
function displayOptions() {
$this->processDisplayOptions();
$this->configureSS->assign('searchFields', $this->currentSearchFields);
return $this->configureSS->fetch($this->configureTpl);
}
}
?>

67
modules/EcmStocks/Delete.php Executable file
View File

@@ -0,0 +1,67 @@
<?php
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/EcmStocks/EcmStock.php');
$focus = new EcmStock();
// PERFORM THE DELETE IF GIVEN A RECORD TO DELETE
if(!isset($_REQUEST['record']))
sugar_die("A record number must be specified to delete the record.");
$focus->retrieve($_REQUEST['record']);
if(!$focus->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->mark_deleted($_REQUEST['record']);
// NOW THAT THE DELETE HAS BEEN PERFORMED, RETURN TO GIVEN LOCATION
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
?>

158
modules/EcmStocks/DetailView.php Executable file
View File

@@ -0,0 +1,158 @@
<?php
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
include("modules/EcmStocks/moduleMenu.php");
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('XTemplate/xtpl.php');
require_once('data/Tracker.php');
require_once('modules/EcmStocks/EcmStock.php');
require_once('modules/EcmStocks/Forms.php');
require_once('include/DetailView/DetailView.php');
global $mod_strings;
global $app_strings;
$focus = new EcmStock();
$detailView = new DetailView();
$offset = 0;
// ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
// A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
$result = $detailView->processSugarBean("ECMSTOCKS", $focus, $offset);
if($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$focus = $result;
}else{
header("Location: index.php?module={EcmStocks}&action=index");
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once($theme_path.'layout_utils.php');
$GLOBALS['log']->info("EcmStocks detail view");
$focus->format_all_fields();
$xtpl=new XTemplate ('modules/EcmStocks/DetailView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("THEME", $theme);
$xtpl->assign("GRIDLINE", $gridline);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("ASSIGNED_TO", $focus->assigned_user_name);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
if($focus->main)$xtpl->assign("CHECKED_MAIN"," checked");
$xtpl->assign("DESCRIPTION", nl2br(url2html($focus->description)));
$xtpl->assign("DIR", $focus->dir);
$xtpl->assign("NO", $focus->no);
$default_bank = "";
$EcmSysInfo = new EcmSysInfo();
foreach($EcmSysInfo->getBanks() as $k => $v){
if($focus->default_bank_id == $v['ID']){
$default_bank = $v['NAME'] . ": " . $v['NUMBER'];
}
}
$xtpl->assign("default_bank", $default_bank);
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
$detailView->processListNavigation($xtpl, "ECMSTOCKS", $offset, $focus->is_AuditEnabled());
// ADDING CUSTOM FIELDS:
require_once('modules/DynamicFields/templates/Files/DetailView.php');
if(!empty($focus->id)) {
$merge_button = <<<EOQ
<input title="{$app_strings['LBL_DUP_MERGE']}" accessKey="M" class="button" onclick="this.form.return_module.value='EcmStocks'; this.form.return_action.value='DetailView';this.form.return_id.value='{$focus->id}'; this.form.action.value='Step1'; this.form.module.value='MergeRecords';" type="submit" name="Merge" value=" {$app_strings['LBL_DUP_MERGE']} "/>
EOQ;
$xtpl->assign("FIND_DUPES_MERGE_BUTTON", $merge_button);
}
$xtpl->parse("main");
$xtpl->out("main");
$sub_xtpl = $xtpl;
$old_contents = ob_get_contents();
ob_end_clean();
ob_start();
echo $old_contents;
require_once('modules/SavedSearch/SavedSearch.php');
$savedSearch = new SavedSearch();
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmStocks')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
?>

253
modules/EcmStocks/EcmStock.php Executable file
View File

@@ -0,0 +1,253 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('data/SugarBean.php');
require_once('include/utils.php');
// SHOULD INCLUDE SELECTIVELY
class EcmStock extends SugarBean {
var $field_name_map = array();
// STANDARD FIELDS
var $id;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $assigned_user_id;
var $name;
//TABLE COLUMNS
var $description;
var $main;
var $dir;
var $no;
// RELATED FIELDS
var $created_by;
var $created_by_name;
var $modified_by_name;
var $assigned_user_name;
// SUBPANELS RELATED
// MODULE OBJECT DETAILS
var $module_dir = 'EcmStocks';
var $table_name = "ecmstocks";
var $object_name = "EcmStock";
//RELATED TABLE NAMES
// USED TO RETRIEVE RELATED FIELDS FROM FORM POSTS.
var $additional_column_fields = Array(
'assigned_user_name',
'assigned_user_id',
'modified_user_id',
'created_by',
);
var $relationship_fields = Array(
//RELATIONSHIP FIELDS
);
function EcmStock() {
parent::SugarBean();
$this->setupCustomFields('EcmStocks');
foreach ($this->field_defs as $field)
{
$this->field_name_map[$field['name']] = $field;
}
}
var $new_schema = true;
function get_summary_text(){
return "$this->name";
}
function create_list_query($order_by, $where, $show_deleted = 0){
// Fill in the assigned_user_name
$custom_join = $this->custom_fields->getJOIN();
$query = "SELECT ";
$query .= "
ecmstocks.*
,users.user_name as assigned_user_name";
if($custom_join){
$query .= $custom_join['select'];
}
$query .= " FROM ecmstocks
LEFT JOIN users
ON ecmstocks.assigned_user_id=users.id";
$query .= " ";
if($custom_join){
$query .= $custom_join['join'];
}
$where_auto = '1=1';
if($show_deleted == 0){
$where_auto = " $this->table_name.deleted=0 ";
}else if($show_deleted == 1){
$where_auto = " $this->table_name.deleted=1 ";
}
if($where != "")
$query .= "where $where AND ".$where_auto;
else
$query .= "where ".$where_auto;
if(substr_count($order_by, '.') > 0){
$query .= " ORDER BY $order_by";
}
else if($order_by != "")
$query .= " ORDER BY $order_by";
else
$query .= " ORDER BY ecmstocks.name";
return $query;
}
function create_export_query($order_by, $where){
$custom_join = $this->custom_fields->getJOIN();
$query = "SELECT
ecmstocks.*,
users.user_name assigned_user_name";
if($custom_join){
$query .= $custom_join['select'];
}
$query .= " FROM ecmstocks ";
$query .= " LEFT JOIN users
ON ecmstocks.assigned_user_id=users.id";
if($custom_join){
$query .= $custom_join['join'];
}
$query .= "";
$where_auto = " ecmstocks.deleted=0
";
if($where != "")
$query .= " where $where AND ".$where_auto;
else
$query .= " where ".$where_auto;
if($order_by != "")
$query .= " ORDER BY $order_by";
else
$query .= " ORDER BY ecmstocks.name";
return $query;
}
function fill_in_additional_list_fields(){
}
function fill_in_additional_detail_fields(){
// FILL IN THE ASSIGNED_USER_NAME
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
$this->created_by_name = get_assigned_user_name($this->created_by);
$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
}
function get_list_view_data(){
global $current_language;
$the_array = parent::get_list_view_data();
$app_list_strings = return_app_list_strings_language($current_language);
$mod_strings = return_module_language($current_language, 'EcmStocks');
// THE NEW LISTVIEW CODE ONLY FETCHES COLUMNS THAT WE'RE DISPLAYING AND NOT ALL
// THE COLUMNS SO WE NEED THESE CHECKS.
$the_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
$the_array['ENCODED_NAME'] = $this->name;
$this->retrieve($this->id);
if($this->main)$maint='<input type="checkbox" readonly="readonly" onclick="location.href=\'index.php?module=EcmStocks&action=setMain&to_pdf=1&record='.$this->id.'\'" checked>';
else $maint='<input type="checkbox" readonly="readonly" onclick="location.href=\'index.php?module=EcmStocks&action=setMain&to_pdf=1&record='.$this->id.'\'">';
$the_array['MAIN']=$maint;
return $the_array;
}
/**
BUILDS A GENERIC SEARCH BASED ON THE QUERY STRING USING OR.
DO NOT INCLUDE ANY $THIS-> BECAUSE THIS IS CALLED ON WITHOUT HAVING THE CLASS INSTANTIATED.
*/
function build_generic_where_clause ($the_query_string) {
$where_clauses = Array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "ecmstocks.name like '$the_query_string%'");
$the_where = "";
foreach($where_clauses as $clause){
if($the_where != "") $the_where .= " or ";
$the_where .= $clause;
}
return $the_where;
}
function set_notification_body($xtpl, $simplemodule){
global $mod_strings, $app_list_strings;
$xtpl->assign("NAME", $simplemodule->name);
$xtpl->assign("ECMSTOCKS_DESCRIPTION", $ecmstocks->description);
return $xtpl;
}
function bean_implements($interface){
switch($interface){
case 'ACL':return true;
}
return false;
}
function save($check_notify = FALSE){
return parent::save($check_notify);
}
}
?>

View File

@@ -0,0 +1,99 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('include/EditView/QuickCreate.php');
require_once('modules/EcmStocks/EcmStock.php');
require_once('include/javascript/javascript.php');
class EcmStocksQuickCreate extends QuickCreate {
var $javascript;
function process() {
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'EcmStocks');
parent::process();
//BUILDER:START dropdowns setup
//BUILDER:END dropdowns setup
if($this->viaAJAX) { // OVERRIDE FOR AJAX CALL
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmstocksQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmstocks\"); else return false;'");
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmstocks\")';");
}
$this->ss->assign('viaAJAX', $this->viaAJAX);
$this->javascript = new javascript();
$this->javascript->setFormName('ecmstocksQuickCreate');
$focus = new EcmStock();
$this->javascript->setSugarBean($focus);
$this->javascript->addAllFields('');
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
$json = getJSONobj();
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'ecmstocksQuickCreate',
'field_to_name_array' => array(
'id' => 'account_id',
'name' => 'account_name',
),
);
$encoded_popup_request_data = $json->encode($popup_request_data);
$this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);
}
}
?>

293
modules/EcmStocks/EditView.php Executable file
View File

@@ -0,0 +1,293 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
include("modules/EcmStocks/moduleMenu.php");
// INCLUDE SUPPPORT MODULES
require_once('XTemplate/xtpl.php');
require_once('data/Tracker.php');
// INCLUDE MODULE OBJECT AND FORMS
require_once('modules/EcmStocks/EcmStock.php');
require_once('modules/EcmStocks/Forms.php');
global $app_strings;
global $mod_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
// INSTANTIATES THE MODULE CLASSES
$focus = new EcmStock();
// IF PROCESSING AN EXISTING RECORD, RETRIEVE IT
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
$focus->unformat_all_fields();
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
$focus->simplemodule_number = "";
}
$prefillArray = array(
'priority' => 'priority',
'name' => 'name',
'description' => 'description',
'status' => 'status',
'type' => 'type',
);
foreach($prefillArray as $requestKey => $focusVar) {
if (isset($_REQUEST[$requestKey]) && is_null($focus->$focusVar)) {
$focus->$focusVar = urldecode($_REQUEST[$requestKey]);
}
}
// BUILD MODULE TITLE LINE
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once ($theme_path.'layout_utils.php');
$GLOBALS['log']->info("EcmStocks detail view");
$default_bank = "<select id='default_bank_id' name='default_bank_id'>";
$EcmSysInfo = new EcmSysInfo();
$default_bank .= "<option value='' ></option>";
echo $focus->default_bank_id;
foreach($EcmSysInfo->getBanks() as $k => $v){
$selected = "";
if($focus->default_bank_id == $v['ID']){
$selected = " selected ";
}
$default_bank .= "<option value='" . $v['ID'] ."' " . $selected.">\"" . $v['NAMESHORT'] . "\" ". $v['NAME'] . ": " . $v['NUMBER'] ."</option>";
}
$default_bank .= "</select>";
$xtpl = new XTemplate ('modules/EcmStocks/EditView.html');
$xtpl->assign("default_bank", $default_bank);
// FILL XTEMPLATE MODULE & APPLICATION LANGUAGE STRINGS
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
if (empty($_REQUEST['return_id'])) {
$xtpl->assign("RETURN_ACTION", 'index');
}
///////////////////////////////////////
// SETUP POPUPS START
// Users Popup
$json = getJSONobj();
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'assigned_user_id',
'user_name' => 'assigned_user_name',
),
);
$xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
//
////////////////////////////////////////////////////////////////////////////////
// ACCOUNT_ID WILL BE SET WHEN USER CHOOSES TO CREATE A NEW SIMPLEMODULE FROM ACCOUNT DETAIL VIEW.
if (isset($_REQUEST['account_id'])) $xtpl->assign("ACCOUNT_ID", $_REQUEST['account_id']);
if (isset($_REQUEST['contact_id'])) $xtpl->assign("CONTACT_ID", $_REQUEST['contact_id']);
// SET THE CASE_ID, IF SET.
// WITH NEW CONCEPT OF SUBPANELS IT,
// WHEN THE SUBPANEL IS DISPLAYED IT PULLS FROM THE CLASS NAME WHICH IN THE SITUATION OF CASES IS ACASE SO THE FORM IS GENERATED
// WITH ACASE_ID INSTEAD OF CASE_ID, SO I HAVE DONE THE MAPPING HERE
if (isset($_REQUEST['acase_id'])) $xtpl->assign("CASE_ID",$_REQUEST['acase_id']);
else if(isset($_REQUEST['case_id'])) $xtpl->assign("CASE_ID",$_REQUEST['case_id']);
////////////////////////////////////////////////////////////////////////////////
// QUICK SEARCH SETUP
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$sqs_objects = array(
'assigned_user_name' => $qsd->getQSUser(),
/*
//BUILDER:START Pro only
'team_name' => $qsd->getQSTeam()
//BUILDER:END Pro only
*/
);
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
// QUICK SEARCH SETUP
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// ASSIGN GLOBAL VARIABLES
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js().get_validate_record_js(). $quicksearch_js);
$xtpl->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
// ASSIGN GLOBAL VARIABLES
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// ASSIGN MODULE DEFAULT VARIABLES
$xtpl->assign("ID", $focus->id);
if (!empty($focus->name))
$xtpl->assign("NAME", $focus->name);
else $xtpl->assign("NAME", "");
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id;
if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name;
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
// ASSIGN MODULE SPECIFIC VARIABLES
if($focus->main)$xtpl->assign("CHECKED_MAIN"," checked");
$xtpl->assign("DESCRIPTION", $focus->description);
$xtpl->assign("DIR", $focus->dir);
$xtpl->assign("NO", $focus->no);
// ASSIGN MODULE DROPDOWNS WITH DEFAULT KEY
// ASSIGN MODULE VARIABLES AFFECTED BY DUPLICATE ACTION
if(!isset($_REQUEST['isDuplicate'])) {
$focus->id = "";
}
// ASSIGN MODULE DROPDOWNS WITHOUT DEFAULT KEY
//BUILDER:END of xtpl
// ADD CUSTOM FIELDS
require_once('modules/DynamicFields/templates/Files/EditView.php');
////////////////////////////////////////////////////////////////////////////////
// USER ASSIGNMENT
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$record = '';
// USER ASSIGNMENT
////////////////////////////////////////////////////////////////////////////////
if(!empty($_REQUEST['record'])){
$record = $_REQUEST['record'];
}
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$xtpl->parse("main");
$xtpl->out("main");
require_once('include/javascript/javascript.php');
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
//BUILDER:START Pro only
// $javascript->addFieldGeneric( 'team_name', 'varchar', $app_strings['LBL_TEAM'] ,'true');
// $javascript->addToValidateBinaryDependency('team_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_TEAM'], 'false', '', 'team_id');
//BUILDER:END Pro only
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();
////////////////////////////////////////////////////////////////////////////////
/// SELECT CHANGES TEXT INPUT FIELD
/*
$prob_array = $json->encode($app_list_strings['sales_probability_dom']);
$prePopProb = '';
if(empty($focus->id)) $prePopProb = 'document.getElementsByName(\'sales_stage\')[0].onchange();';
echo <<<EOQ
<script>
prob_array = $prob_array;
document.getElementsByName('sales_stage')[0].onchange = function() {
if(typeof(document.getElementsByName('sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('sales_stage')[0].value]) {
document.getElementsByName('probability')[0].value = prob_array[document.getElementsByName('sales_stage')[0].value];
}
};
$prePopProb
</script>
EOQ;
*/
//
/// SELECT CHANGES TEXT INPUT FIELD
////////////////////////////////////////////////////////////////////////////////
require_once('modules/SavedSearch/SavedSearch.php');
$savedSearch = new SavedSearch();
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmStocks')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
?>

111
modules/EcmStocks/Forms.php Executable file
View File

@@ -0,0 +1,111 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
/*******************************************************************************
* CREATE JAVASCRIPT TO VALIDATE THE DATA ENTERED INTO A RECORD.
*******************************************************************************/
function get_validate_record_js () {
}
/*******************************************************************************
* CREATE FORM FOR MENU RAPID CREATE
*******************************************************************************/
function get_new_record_form () {
if(!ACLController::checkAccess('EcmStocks', 'edit', true)){
return '';
}
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $current_user;
$lbl_subject = $mod_strings['LBL_SUBJECT'];
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
$user_id = $current_user->id;
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
$the_form .= <<<EOQ
<form name="EcmStockSave" onSubmit="return check_form('EcmStocksSave')" method="POST" action="index.php">
<input type="hidden" name="module" value="EcmStocks">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value='${user_id}'>
<input type="hidden" name="action" value="Save">
${lbl_subject}&nbsp;<span class="required">${lbl_required_symbol}</span><br>
<p><input name='name' type="text" size='20' maxlength="255"value=""><br>
</p>
<p>
<input title="${lbl_save_button_title}" accessKey="${lbl_save_button_key}" class="button" type="submit" name="button" value=" ${lbl_save_button_label} " >
</p>
</form>
EOQ;
require_once('include/javascript/javascript.php');
require_once('modules/EcmStocks/EcmStock.php');
$javascript = new javascript();
$javascript->setFormName('EcmStocksSave}');
$javascript->setSugarBean(new EcmStock());
$javascript->addRequiredFields('');
$the_form .= $javascript->getScript();
$the_form .= get_left_form_footer();
return $the_form;
}
?>

187
modules/EcmStocks/ListView.php Executable file
View File

@@ -0,0 +1,187 @@
<?php
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once ('XTemplate/xtpl.php');
require_once ("data/Tracker.php");
require_once ('modules/EcmStocks/EcmStock.php');
require_once ('themes/'.$theme.'/layout_utils.php');
require_once ('log4php/LoggerManager.php');
require_once('include/ListView/ListViewSmarty.php');
require_once('modules/Currencies/Currency.php');
if(file_exists('custom/modules/EcmStocks/metadata/listviewdefs.php')){
require_once('custom/modules/EcmStocks/metadata/listviewdefs.php');
}else{
require_once('modules/EcmStocks/metadata/listviewdefs.php');
}
require_once('modules/SavedSearch/SavedSearch.php');
require_once('include/SearchForm/SearchForm.php');
$header_text = '';
global $app_strings;
global $mod_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'EcmStocks');
global $urlPrefix;
global $currentModule;
global $theme;
global $current_user;
// FOCUS_LIST IS THE MEANS OF PASSING DATA TO A LISTVIEW.
global $focus_list;
// SETUP QUICKSEARCH
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
// CLEAR THE DISPLAY COLUMNS BACK TO DEFAULT WHEN CLEAR QUERY IS CALLED
if(!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true')
$current_user->setPreference('ListViewDisplayColumns', array(), 0, $currentModule);
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', $currentModule); // GET USER DEFINED DISPLAY COLUMNS
$json = getJSONobj();
$seedEcmStock = new EcmStock(); // SEED BEAN
$searchForm = new SearchForm('EcmStocks', $seedEcmStock); // NEW SEARCHFORM INSTANCE
// SETUP LISTVIEW SMARTY
$lv = new ListViewSmarty();
$displayColumns = array();
// CHECK $_REQUEST IF NEW DISPLAY COLUMNS FROM POST
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs['EcmStocks'][$col]))
$displayColumns[$col] = $listViewDefs['EcmStocks'][$col];
}
}elseif(!empty($savedDisplayColumns)) { // USE USER DEFINED DISPLAY COLUMNS FROM PREFERENCES
$displayColumns = $savedDisplayColumns;
}else { // USE COLUMNS DEFINED IN LISTVIEWDEFS FOR DEFAULT DISPLAY COLUMNS
foreach($listViewDefs['EcmStocks'] as $col => $params) {
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
}
$params = array('massupdate' => true); // SETUP LISTVIEWSMARTY PARAMS
if(!empty($_REQUEST['orderBy'])) { // ORDER BY COMING FROM $_REQUEST
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$lv->displayColumns = $displayColumns;
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) { // HANDLE AJAX REQUESTS FOR SEARCH FORMS ONLY
switch($_REQUEST['search_form_view']) {
case 'basic_search':
$searchForm->setup();
$searchForm->displayBasic(false);
break;
case 'advanced_search':
$searchForm->setup();
$searchForm->displayAdvanced(false);
break;
case 'saved_views':
echo $searchForm->displaySavedViews($listViewDefs, $lv, false);
break;
}
return;
}
// USE THE STORED QUERY IF THERE IS ONE
if (!isset($where)) $where = "";
require_once('modules/MySettings/StoreQuery.php');
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
}else{
$storeQuery->saveFromGet($currentModule);
}
if(isset($_REQUEST['query'])){
// WE HAVE A QUERY
// FIRST SAVE COLUMNS
$current_user->setPreference('ListViewDisplayColumns', $displayColumns, 0, $currentModule);
$searchForm->populateFromRequest(); // GATHERS SEARCH FIELD INPUTS FROM $_REQUEST
$where_clauses = $searchForm->generateSearchWhere(true, "EcmStock"); // BUILDS THE WHERE CLAUSE FROM SEARCH FIELD INPUTS
if (count($where_clauses) > 0 )$where = implode(' and ', $where_clauses);
$GLOBALS['log']->info("Here is the where clause for the list view: $where");
}
// START DISPLAY
// WHICH TAB OF SEARCH FORM TO DISPLAY
if(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
$searchForm->setup();
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$searchForm->displayAdvanced();
}elseif(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'saved_views'){
$searchForm->displaySavedViews($listViewDefs, $lv);
}else {
$searchForm->displayBasic();
}
}
echo $qsd->GetQSScripts();
$lv->setup($seedEcmStock, 'include/ListView/ListViewGeneric.tpl', $where, $params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
echo $lv->display();
$savedSearch = new SavedSearch();
$json = getJSONobj();
// FILLS IN SAVED VIEWS SELECT BOX ON SHORTCUT MENU
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmStocks')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
?>

View File

@@ -0,0 +1,73 @@
<?
global $mod_strings;
$_SESSION['stock_order_by']=$_REQUEST['order_by'];
$_SESSION['stock_sorder']=$_REQUEST['sorder'];
$_SESSION['stock_sorder']=$_REQUEST['sorder'];
$_SESSION['stock_id']=$_REQUEST['pricebook_id'];
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$_REQUEST['stock_id']."'"));
$name=$r['name'];
function sortLink($order_by,$sorder,$title)
{
if($order_by==$_REQUEST['order_by'])
{
if($sorder=="desc")
{
$img='<img border="0" src="themes/Sugar/images/arrow_down.gif" width="8" height="10" align="absmiddle" alt="">';
$s="asc";
}
else
{
$img='<img border="0" src="themes/Sugar/images/arrow_up.gif" width="8" height="10" align="absmiddle" alt="">';
$s="desc";
}
}
else
{
$img='<img border="0" src="themes/Sugar/images/arrow.gif" width="8" height="10" align="absmiddle" alt="">';
$s=$sorder;
}
return '<a style="cursor:pointer;" onclick="mintajaxget(\'index.php?to_pdf=1&module=EcmStocks&action=ListViewProductsAjax&stock_id='.$_REQUEST['stock_id'].'&order_by='.$order_by.'&sorder='.$s.'\',\'products\');">'.$title.'&nbsp;'.$img.'</a>';
}
$c=array("ecmstockin.price_in","ecmstockin.date_in","ecmstockin.quantity_in","ecmstockin.quantity_out","ecmstockin.pz_id");
$t=array($mod_strings['LBL_PRICE'],$mod_strings['LBL_DATE'],$mod_strings['LBL_QTY_IN'],$mod_strings['LBL_QTY_OUT'],$mod_strings['LBL_PZ']);
$sorder=$_REQUEST['sorder'];
print '<h4>Products List:</h4><br>';
print '<table cellpadding="0" cellspacing="0" width="100%" border="0" class="ListView"><tr>';
print '<td class="listViewThS1">'.sortLink("ecmproducts.name",$sorder,$mod_strings['LBL_PRODUCT_NAME']).'</td>';
for($i=0;$i<count($t);$i++)
{
$corder_by=$c[$i];
if($t[$i])print '<td class="listViewThS1">'.sortLink($corder_by,$sorder,$t[$i]).'</td>';
}
print '<td class="listViewThS1">&nbsp;</td>';
print '<td class="listViewThS1">&nbsp;</td>';
print '</tr>';
$z="select ecmstockins.*,ecmproducts.name as product_name,ecmstockdocins.name as pz_name from ecmstockins inner join ecmproducts on ecmproducts.id=ecmstockins.product_id inner join ecmstockdocins on ecmstockdocins.id=ecmstockins.pz_id where ecmstockins.stock_id='".$_REQUEST['stock_id']."' order by ".$_REQUEST['order_by']." ".$_REQUEST['sorder'];
$result = $GLOBALS['db']->query($z);
while($row=$GLOBALS['db']->fetchByAssoc($result))
{
print '<tr>';
print '<td class="oddListRowS1"><a href="index.php?module=EcmProducts&action=DetailView&record='.$row['product_id'].'">'.$row['product_name'].'</a></td>';
for($i=0;$i<count($t);$i++)
{
if($t[$i])
{
if($c[$i]=="ecmstockin.pz_id")print '<td class="oddListRowS1"><a href="index.php?module=EcmStockDocIns&action=DetailView&record='.$row['pz_id'].'">'.$row['pz_name'].'</a></td>';
elseif($c[$i]=="ecmstockin.date_in")print '<td class="oddListRowS1">'.$timedate->to_display($row['date_in'],"Y-m-d",$timedate->get_date_format()).'</td>';
elseif($c[$i]=="ecmstockin.price_in")print '<td class="oddListRowS1">'.number_format($row['price_in'],2,$GLOBALS['sugar_config']['default_decimal_seperator'],$GLOBALS['sugar_config']['default_number_grouping_seperator']).'</td>';
else print '<td class="oddListRowS1">'.$row[str_replace("ecmstockin.","",$c[$i])].'</td>';
}
}
print '</tr>';
}
print '</table>';
?>

58
modules/EcmStocks/Menu.php Executable file
View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
global $mod_strings;
$module="EcmStocks";
if(ACLController::checkAccess($module, 'edit', true))$module_menu [] = Array("index.php?module=".$module."&action=EditView&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_NEW_'.strtoupper($module)],"Create".$module,$module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=index&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_'.strtoupper($module).'_LIST'],$module, $module);
?>

57
modules/EcmStocks/Popup.php Executable file
View File

@@ -0,0 +1,57 @@
<?php
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/Popups/Popup_picker.php');
$popup = new Popup_Picker();
echo $popup->process_page();
?>

View File

@@ -0,0 +1,147 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
global $theme;
require_once('modules/EcmStocks/EcmStock.php');
require_once('themes/'.$theme.'/layout_utils.php');
require_once('log4php/LoggerManager.php');
require_once('XTemplate/xtpl.php');
require_once('include/ListView/ListView.php');
$image_path = 'themes/'.$theme.'/images/';
class Popup_Picker{
function Popup_Picker(){
;
}
function _get_where_clause(){
$where = '';
if(isset($_REQUEST['query'])){
$where_clauses = array();
append_where_clause($where_clauses, "name", "ecmstocks.name");
$where = generate_where_statement($where_clauses);
}
return $where;
}
function process_page(){
global $theme;
global $mod_strings;
global $app_strings;
global $currentModule;
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$image_path = 'themes/'.$theme.'/images/';
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if(!$hide_clear_button){
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CLEAR_BUTTON_KEY'] ."' value=' "
.$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CANCEL_BUTTON_KEY'] ."' value=' "
.$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n";
$button .= "</form>\n";
$form = new XTemplate('modules/EcmStocks/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('NAME', $name);
$form->assign('request_data', $request_data);
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
$output_html .= get_form_footer();
// RESET THE SECTIONS THAT ARE ALREADY IN THE PAGE SO THAT THEY DO NOT PRINT AGAIN LATER.
$form->reset('main.SearchHeader');
// CREATE THE LISTVIEW
$seed_bean = new EcmStock();
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'name', 'ECMSTOCK');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'ECMSTOCK');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
} // end of class Popup_Picker
?>

87
modules/EcmStocks/Save.php Executable file
View File

@@ -0,0 +1,87 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('modules/EcmStocks/EcmStock.php');
require_once('include/formbase.php');
$focus = new EcmStock();
$GLOBALS['db']->query("update ecmstocks set main='0'");
$focus->retrieve($_POST['record']);
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (!empty($_POST['assigned_user_id']) && ($focus->assigned_user_id != $_POST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
$check_notify = TRUE;
}else{
$check_notify = FALSE;
}
foreach($focus->column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
foreach($focus->additional_column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
$focus->unformat_all_fields();
$focus->save($check_notify);
$return_id = $focus->id;
handleRedirect($return_id,'EcmStocks');
?>

View File

@@ -0,0 +1,130 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
require_once("include/ListView/ListView.php");
global $app_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'EcmStocks');
$header_text = '';
global $currentModule;
global $theme;
global $focus;
global $action;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
///////////////////////////////////////
/// SETUP PARENT POPUP
$popup_request_data = array(
'call_back_function' => 'set_return_and_save',
'form_name' => 'DetailView',
'field_to_name_array' => array(
'id' => 'ecmstock_id',
),
);
$json = getJSONobj();
$encoded_popup_request_data = $json->encode($popup_request_data);
///
///////////////////////////////////////
// FOCUS_LIST IS THE MEANS OF PASSING DATA TO A SUBPANELVIEW.
global $focus_list;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
$button .= "<input type='hidden' name='module' value='EcmStocks'>\n";
if ($currentModule == 'Accounts') {
$button .= "<input type='hidden' name='account_id' value='$focus->id'>\n";
$button .= "<input type='hidden' name='account_name' value='$focus->name'>\n";
}elseif ($currentModule == 'Contacts') {
$button .= "<input type='hidden' name='account_id' value='$focus->account_id'>\n";
$button .= "<input type='hidden' name='account_name' value='$focus->account_name'>\n";
$button .= "<input type='hidden' name='contact_id' value='$focus->id'>\n";
}elseif ($currentModule == 'Cases') {
$button .= "<input type='hidden' name='case_id' value='$focus->id'>\n";
}
$button .= "<input type='hidden' name='return_module' value='".$currentModule."'>\n";
$button .= "<input type='hidden' name='return_action' value='".$action."'>\n";
$button .= "<input type='hidden' name='return_id' value='".$focus->id."'>\n";
$button .= "<input type='hidden' name='action'>\n";
$button .= "<input title='".$app_strings['LBL_NEW_BUTTON_TITLE']
."' accessKey='".$app_strings['LBL_NEW_BUTTON_KEY']
."' class='button' onclick=\"this.form.action.value='EditView'\" type='submit' name='New' value=' "
.$app_strings['LBL_NEW_BUTTON_LABEL']." '>\n";
$button .= "<input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."' accessKey='"
.$app_strings['LBL_SELECT_BUTTON_KEY']."' type='button' class='button' value=' "
.$app_strings['LBL_SELECT_BUTTON_LABEL']
." ' name='button' onclick='open_popup(\"EcmStocks\", 600, 400, \"\", false, true, {$encoded_popup_request_data});'>\n";
$button .= "</form>\n";
$ListView = new ListView();
$ListView->initNewXTemplate( 'modules/EcmStocks/SubPanelView.html',$current_module_strings);
$ListView->xTemplateAssign("RETURN_URL", "&return_module=".$currentModule."&return_action=DetailView&return_id={$_REQUEST['record']}");
$ListView->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path.'edit_inline', 'align="absmiddle" alt="'.$app_strings['LNK_EDIT'] .'" border="0"'));
$ListView->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path.'delete_inline','align="absmiddle" alt="'.$app_strings['LNK_REMOVE'].'" border="0"'));
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=SubPanelView&from_module=EcmStocks&record="
.$_REQUEST['record']."'>"
.get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")
."</a>";
}
$ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME'] . $header_text );
$ListView->setHeaderText($button);
$ListView->processListView($focus_list, "main", "ECMSTOCK");
?>

View File

@@ -0,0 +1,81 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$fields_array['EcmStock'] = array (
'column_fields' => Array(
"id",
"name",
"date_entered",
"date_modified",
"modified_user_id",
"assigned_user_id",
"created_by",
//NEW COLUMN FIELDS
"description",
"main",
"dir",
"no",
),
'list_fields' => Array(
'id',
'name',
'assigned_user_name',
'assigned_user_id',
//NEW LIST_FIELDS
'description',
'main',
'dir',
'no',
),
'required_fields' => array(
'name'=>1
),
);
?>

View File

@@ -0,0 +1,50 @@
<?
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$_GET['template_id']."'"));
//print mysql_error();
$per=$r['documents_per'];
$format=$r['document_number_format_id'];
$date=$timedate->to_display($_GET['date'], $timedate->get_date_format(), "Y-m-d");
$exp=explode("-",$date);
if($per=="day")$daten=$date;
if($per=="month")$daten=$exp[0]."-".$exp[1];
if($per=="year")$daten=$exp[0];
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select number from ".$_GET['table']." where ".$_GET['date_field']." like '".$daten."%' order by number desc limit 1"));
$no=$r['number']+1;
//$number=$_GET['prefix']."/".$no."/".$exp[1]."/".$exp[0];
if($format[1]=="/")$sep="/";
elseif($format[1]==".")$sep=".";
elseif($format[1]=="-")$sep="-";
else $sep="";
if($format=="NR/D/M/Y")$sep="/";
if($format=="NR.D.M.Y")$sep=".";
if($format=="NR D/M/Y")$sep=" ";
if($format=="NR-D-M-Y")$sep="-";
if($format=="NRDMY")$sep="";
/*
if($per=="month")
{
$format=str_replace("D "," ",$format);
$format=str_replace("D-","",$format);
$format=str_replace("D/","",$format);
$format=str_replace("D.","",$format);
}
if($per=="year")
{
$format=str_replace("D "," ",$format);
$format=str_replace("D-","",$format);
$format=str_replace("M-","",$format);
$format=str_replace("D/","",$format);
$format=str_replace("M/","",$format);
$format=str_replace("D.","",$format);
$format=str_replace("M.","",$format);
}*/
$format=str_replace("NR",$no,$format);
$format=str_replace("Y",$exp[0],$format);
$format=str_replace("M",$exp[1],$format);
$format=str_replace("D",$exp[2],$format);
$number=$_GET['prefix'].$sep.$format;
if($_GET['show_number'])print $number;
else print $no;
?>

View File

@@ -0,0 +1,35 @@
<?
function generateNumberF($template_id,$date,$table,$date_field,$show_number=1){
global $timedate;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$template_id."'"));
$per=$r['documents_per'];
$format=$r['document_number_format_id'];
//$date=$timedate->to_display($date, $timedate->get_date_format(), "Y-m-d");
$exp=explode("-",$date);
if($per=="day")$daten=$date;
if($per=="month")$daten=$exp[0]."-".$exp[1];
if($per=="year")$daten=$exp[0];
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select number from ".$table." where ".$date_field." like '".$daten."%' order by number desc limit 1"));
$no=$r['number']+1;
if($format[1]=="/")$sep="/";
elseif($format[1]==".")$sep=".";
elseif($format[1]=="-")$sep="-";
else $sep="";
if($format=="NR/D/M/Y")$sep="/";
if($format=="NR.D.M.Y")$sep=".";
if($format=="NR D/M/Y")$sep=" ";
if($format=="NR-D-M-Y")$sep="-";
if($format=="NRDMY")$sep="";
$format=str_replace("NR",$no,$format);
$format=str_replace("Y",$exp[0],$format);
$format=str_replace("M",$exp[1],$format);
$format=str_replace("D",$exp[2],$format);
$number="ZD".$sep.$format;
if($show_number)return $number;
else return $no;
}
?>

View File

@@ -0,0 +1,36 @@
<?
if($_GET['stock_id'])$stock=" and stock_id='".$_GET['stock_id']."'";
else $stock="";
/*$z="select * from ecmstockoperations where deleted='0' and product_id='".$_GET['id']."'".$stock;
$w=$GLOBALS['db']->query($z);
$total=0;
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
if($r['type']=="0" || $r['type']=="2")$total+=$r['quantity'];
elseif($r['type']=="1") $total-=$r['quantity'];
}*/
$q1=0;
/*$w=$GLOBALS['db']->query("select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL".$stock." and product_id='".$_GET['id']."'");
while($rrr=$GLOBALS['db']->fetchByAssoc($w)){
$ww=$GLOBALS['db']->query("select quantity from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL".$stock." and product_id='".$_GET['id']."' and deleted='0'");
$rqty=0;
while($rrp=$GLOBALS['db']->fetchByAssoc($ww)){
$rqty+=$rrp['quantity'];
}
$qty=$rrr['qty']-$rqty;
if($qty>0){
$arr[]=array("qty"=>$qty,"id"=>$rrr['id'],"price"=>$rrr['price']);
}
}
if(count($arr)>0){
foreach($arr as $v){
$q1+=$v['qty'];
$pp1+=$v['qty']*$v['price'];
}
}*/
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select quantity from ecmstockstates where deleted='0' and product_id='".$_GET['id']."'".$stock));
$q1=$r['quantity'];
print $q1;
?>

643
modules/EcmStocks/helperPDF.php Executable file
View File

@@ -0,0 +1,643 @@
<?
function getInfoEdit($date_field="date")
{
//template info
$template_id = $_SESSION['PREVIEW_PDF']['template_id'];
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$template_id."'"));
$arr['template_logo_path']=$rr['logo_path'];
$arr['header_text']=$rr['header_text'];
$arr['footer_text']=$rr['footer_text'];
$account_id=$rr['account_id'];
//from info
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from accounts where id='".$account_id."'"));
$arr['from_name'] = $rr['name'];
$arr['from_address_street']=$rr['billing_address_street'];
$arr['from_address_city']=$rr['billing_address_city'];
$arr['from_address_postalcode']=$rr['billing_address_postalcode'];
//$assigned_user_id=$rr['assigned_user_id'];
//to info
$arr['to_name'] = $_SESSION['PREVIEW_PDF']['to_name'];
$arr['to_address_street'] = $_SESSION['PREVIEW_PDF']['to_address_street'];
$arr['to_address_postalcode'] = $_SESSION['PREVIEW_PDF']['to_address_postalcode'];
$arr['to_address_city'] = $_SESSION['PREVIEW_PDF']['to_address_city'];
//date
$arr['date'] = $_SESSION['PREVIEW_PDF'][$date_field];
//no
$arr['no'] = $_SESSION['PREVIEW_PDF']['name'];
//user
$assigned_user_id = $_SESSION['PREVIEW_PDF']['assigned_user_id'];
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name,last_name from users where id='".$assigned_user_id."'"));
$arr['user_name']=$r['first_name']." ".$r['last_name'];
//invoice
$arr['invoice_name'] = $_SESSION['PREVIEW_PDF']['invoice_name'];
return $arr;
}
function getInfo($table,$document_id,$date_field="date")
{
global $timedate;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ".$table." where id='".$document_id."'"));
//template info
$template_id = $r['template_id'];
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$template_id."'"));
$arr['template_logo_path']=$rr['logo_path'];
$arr['header_text']=$rr['header_text'];
$arr['footer_text']=$rr['footer_text'];
$account_id=$rr['account_id'];
//from info
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from accounts where id='".$account_id."'"));
$arr['from_name'] = $rr['name'];
$arr['from_address_street']=$rr['billing_address_street'];
$arr['from_address_city']=$rr['billing_address_city'];
$arr['from_address_postalcode']=$rr['billing_address_postalcode'];
$arr['assigned_user_id']=$rr['assigned_user_id'];
//to info
$arr['to_name'] = $r['to_name'];
$arr['to_address_street'] = $r['to_address_street'];
$arr['to_address_postalcode'] = $r['to_address_postalcode'];
$arr['to_address_city'] = $r['to_address_city'];
//date
$arr['date'] = $timedate->to_display($r[$date_field],"Y-m-d",$timedate->get_date_format());
//no
$arr['no'] = $r['name'];
//user
$assigned_user_id = $r['assigned_user_id'];
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name,last_name from users where id='".$assigned_user_id."'"));
$arr['user_name']=$rr['first_name']." ".$rr['last_name'];
//invoice
$arr['invoice_name'] = $r['invoice_name'];
//$footer_text = $r['footer_text'];
//$header_text = $r['header_text'];
return $arr;
}
function getProductsArrayEdit($products)
{
//print_r($products);
foreach($products as $key=>$r)
{
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select tax_class_id from ecmproducts where id='".$r['id']."'"));
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select value,name from ecmproducttaxs where id='".$rr['tax_class_id']."'"));
$tax=$rr['value'];
$tax_name=$rr['name'];
$netto_value=round($r['quantity']*$r['price'],2);
$brutto_value=round($netto_value*(1+$tax/100),2);
$tax_value=round($netto_value*$tax/100,2);
$total_netto_value+=round($netto_value,2);
$total_brutto_value+=round($brutto_value,2);
$total_tax_value+=round($tax_value,2);
$table[]=array(
'index'=>array('width'=>5,
'value' =>$i+1,
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'product_index'=>array('width'=>10,
'value' =>$r['product_index'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'name'=>array('width'=>30,
'value' =>$r['name'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'quantity'=>array('width'=>10,
'value' =>$r['quantity'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'price'=>array('width'=>10,
'value' =>$r['price'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'netto'=>array('width'=>10,
'value' =>number_format($netto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'brutto'=>array('width'=>10,
'value' =>number_format($brutto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'tax'=>array('width'=>10,
'value' =>number_format($tax_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$i++;
}
$table[$i]['total_netto_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i]['total_netto_label']=array('width'=>20,
'value' =>'Suma',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i]['total_netto_value']=array('width'=>15,
'value' =>number_format($total_netto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_label']=array('width'=>20,
'value' =>'VAT',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_value']=array('width'=>15,
'value' =>number_format($total_tax_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_label']=array('width'=>20,
'value' =>'Suma końcowa',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_value']=array('width'=>15,
'value' =>number_format($total_brutto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
return $table;
}
function getProductsArray($document_id,$document_type)
{
$w=$GLOBALS['db']->query("select * from ecmproductsdocumentsrelations where document_id='".$document_id."' and document_type='".$document_type."' and deleted='0' order by product_position asc");
$i=1;
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select tax_class_id from ecmproducts where id='".$r['product_id']."'"));
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select value,name from ecmproducttaxs where id='".$rr['tax_class_id']."'"));
$tax=$rr['value'];
$tax_name=$rr['name'];
$netto_value=round($r['product_quantity']*$r['product_price'],2);
$brutto_value=round($netto_value*(1+$tax/100),2);
$tax_value=round($netto_value*$tax/100,2);
$total_netto_value+=$netto_value;
$total_brutto_value+=$brutto_value;
$total_tax_value+=$tax_value;
$table[]=array(
'index'=>array('width'=>5,
'value' =>$i,
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'product_index'=>array('width'=>10,
'value' =>$r['product_code'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'name'=>array('width'=>30,
'value' =>$r['product_name'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'quantity'=>array('width'=>10,
'value' =>$r['product_quantity'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'price'=>array('width'=>10,
'value' =>$r['product_price'],
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'netto'=>array('width'=>10,
'value' =>number_format($netto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'brutto'=>array('width'=>10,
'value' =>number_format($brutto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
'tax'=>array('width'=>10,
'value' =>number_format($tax_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$i++;
}
$table[$i]['total_netto_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i]['total_netto_label']=array('width'=>20,
'value' =>'Suma',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i]['total_netto_value']=array('width'=>15,
'value' =>number_format($total_netto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_label']=array('width'=>20,
'value' =>'VAT',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+1]['total_tax_value']=array('width'=>15,
'value' =>number_format($total_tax_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_blank']=array('width'=>60,
'value' =>'',
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_label']=array('width'=>20,
'value' =>'Suma końcowa',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
);
$table[$i+2]['total_brutto_value']=array('width'=>15,
'value' =>number_format($total_brutto_value,2,",","."),
'background'=>array(255,255,255),
'border'=>0,
'overflow'=>1,
'align'=>'R',
'font-size'=>9,
'font-style'=>'b',
);
return $table;
}
function getHeaderArray()
{
$table[]=array(
'index'=>array('width'=>5,
'value' =>"Lp",
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'product_index'=>array('width'=>10,
'value' =>'Index',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'name'=>array('width'=>30,
'value' =>'Opis',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'quantity'=>array('width'=>10,
'value' =>'Ilość',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'price'=>array('width'=>10,
'value' =>'Cena',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'netto'=>array('width'=>10,
'value' =>'Netto',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'brutto'=>array('width'=>10,
'value' =>'Brutto',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
'tax'=>array('width'=>10,
'value' =>'VAT',
'background'=>array(233,233,233),
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'b',
),
);
return $table;
}
function getCompanyTable($from_name,$from_address_street,$from_address_postalcode,$from_address_city,$to_name,$to_address_street,$to_address_postalcode,$to_address_city)
{
$table[]=array(
'company_line'=>array('width'=>100,
'value' =>$from_name." - ".$from_address_street." ".$from_address_postalcode." ".$from_address_city,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'u',
),
);
$table[]=array(
'to_name'=>array('width'=>100,
'value' =>$to_name,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$table[]=array(
'to_address_street'=>array('width'=>100,
'value' =>$to_address_street,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$table[]=array(
'to_address_postalcode'=>array('width'=>100,
'value' =>$to_address_postalcode." - ".$to_address_city,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
return $table;
}
function getRightBlockArray($no,$date,$user_name)
{
$table[]=array(
'numer'=>array('width'=>100,
'value' =>'Numer',
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'B',
),
);
$table[]=array(
'numer_value'=>array('width'=>100,
'value' =>$no,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$table[]=array(
'data'=>array('width'=>100,
'value' =>'Data wystawienia',
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'B',
),
);
$table[]=array(
'data_value'=>array('width'=>100,
'value' =>$date,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
$table[]=array(
'wystawil'=>array('width'=>100,
'value' =>'Wystawił',
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'B',
),
);
$table[]=array(
'wystawil_value'=>array('width'=>100,
'value' =>$user_name,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
return $table;
}
function getLeftBlockArray($to_name,$type_name)
{
$table[]=array(
'type'=>array('width'=>100,
'value' =>$type_name,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>20,
'font-style'=>'',
),
);
$table[]=array(
'type'=>array('width'=>100,
'value' =>$type_name.' dla '.$to_name,
'border'=>0,
'overflow'=>1,
'align'=>'L',
'font-size'=>9,
'font-style'=>'',
),
);
return $table;
}
?>

62
modules/EcmStocks/index.php Executable file
View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
include("modules/EcmStocks/moduleMenu.php");
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once ($theme_path."layout_utils.php");
global $mod_strings;
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_TITLE'], true);
echo "\n</p>\n";
include ('modules/EcmStocks/ListView.php');
?>

View File

@@ -0,0 +1,129 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$mod_strings = array (
// added
'LBL_MAIN' => 'Main',
'LBL_DIR' => 'Dir',
'LBL_NO' => 'Syymbol',
'LBL_STOCK_DETAILS' => 'Inventory Details:',
'LBL_DETAILS' => 'Details',
'LBL_ITEMS' => 'Items',
'LBL_PRICE' => 'Price',
'LBL_DATE' => 'Date',
'LBL_QTY_IN' => 'Qty In',
'LBL_QTY_OUT' => 'Qty Out',
'LBL_PZ' => 'PZ',
'LBL_PRODUCT_NAME' => 'Product Name',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Inventory',
'LBL_MODULE_TITLE' => 'Inventory: Home',
'LBL_MODULE_ID' => 'Inventory',
'LBL_SEARCH_FORM_TITLE' => 'Inventory Search',
'LBL_LIST_FORM_TITLE' => 'Inventories List',
'LBL_NEW_FORM_TITLE' => 'New Inventory',
'LBL_ECMSTOCKS' => 'Inventory:',
'LBL_ECMSTOCKS_SUBJECT' => 'Inventory Subject:',
'LBL_SYSTEM_ID' => 'System ID',
// FOR LIST VIEW
'LBL_LIST_NAME' => 'Name',
'LBL_LIST_SUBJECT' => 'Subject',
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
'LBL_LIST_MY_ECMSTOCKS' => 'My Assigned Inventories',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
'LBL_LIST_DESCRIPTION' => 'Description',
// FOR NOTIFICATION POPUPS
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to remove this ecmstock from this Inventory?',
'NTC_REMOVE_INVITEE' => 'Are you sure you want to remove this contact from the Inventory?',
'NTC_REMOVE_ACCOUNT_CONFIRMATION' => 'Are you sure you want to remove this ecmstock from this account?',
'ERR_DELETE_RECORD' => 'A record number must be specified to delete the stock.',
// FOR DEFAULT FIELDS
'LBL_NAME' => 'Name:',
'LBL_SUBJECT' => 'Name:',
'LBL_CREATED_BY' => 'Created by:',
'LBL_CREATED' => 'Created by:',
'LBL_ASSIGNED_TO' => 'Assigned to:',
'LBL_ASSIGNED_USER_ID' => 'Assigned To:',
'LBL_DATE_ENTERED' => 'Date Created:',
'LBL_DATE_CREATED' => 'Create Date:',
'LBL_DATE_MODIFIED' => 'Last Modified',
'LBL_MODIFIED_BY' => 'Last Modified by:',
'LBL_MODIFIED' => 'Modified by:',
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
// FOR NEW FIELDS
'LBL_DESCRIPTION' => 'Description',
// FOR GROUPS
'LBL_GROUP_MASTER' => 'STOCK INFORMATION',
'LBL_GROUP_DESCRIPTION' => '',
// FOR SUBPANELS
'LBL_ECMSTOCKS_SUBPANEL_TITLE' => 'Inventory',
'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Activities',
'LBL_HISTORY_SUBPANEL_TITLE' => 'History',
'LBL_ECMSTOCKS' => 'Inventory',
// FOR MENU LABELS
'LNK_NEW_ECMSTOCKS' => 'Create Inventory',
'LNK_LIST_ECMSTOCK' => 'Inventories List',
// FOR MENU LINKS
'LNK_NEW_ECMSTOCK' => 'Create Inventory',
'LNK_ECMSTOCKS_LIST' => 'Inventories',
'LNK_ECMSTOCKS_REPORTS' => 'Inventory Reports',
// FOR ADDITIONAL MENUS
// FOR DASHLETS
'LBL_LIST_ECMSTOCKS' => 'Inventory',
);
?>

View File

@@ -0,0 +1,129 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$mod_strings = array (
// added
'LBL_MAIN' => 'Główny',
'LBL_DIR' => 'Katalog',
'LBL_NO' => 'Symbol',
'LBL_STOCK_DETAILS' => 'Szczegóły Magazynu:',
'LBL_DETAILS' => 'Szczegóły',
'LBL_ITEMS' => 'Wpisy',
'LBL_PRICE' => 'Cena',
'LBL_DATE' => 'Data',
'LBL_QTY_IN' => 'Ilość wejść',
'LBL_QTY_OUT' => 'Ilość zejść',
'LBL_PZ' => 'PZ',
'LBL_PRODUCT_NAME' => 'Nazwa Produktu',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Magazyny',
'LBL_MODULE_TITLE' => 'Magazyny: Strona Główna',
'LBL_MODULE_ID' => 'Magazyny',
'LBL_SEARCH_FORM_TITLE' => 'Magazyny Wyszukiwanie',
'LBL_LIST_FORM_TITLE' => 'Lista Magazynów',
'LBL_NEW_FORM_TITLE' => 'Nowy Magazyn',
'LBL_ECMSTOCKS' => 'Magazyny:',
'LBL_ECMSTOCKS_SUBJECT' => 'Tytuł Magazynu:',
'LBL_SYSTEM_ID' => 'System ID',
// FOR LIST VIEW
'LBL_LIST_NAME' => 'Nazwa',
'LBL_LIST_SUBJECT' => 'Tytuł',
'LBL_LIST_LAST_MODIFIED' => 'Ostatnio Modyfikowane',
'LBL_LIST_MY_ECMSTOCKS' => 'Moje Przypisane Magazyny',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Przypisany Uzytkownik',
'LBL_LIST_DESCRIPTION' => 'Opis',
// FOR NOTIFICATION POPUPS
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to remove this ecmstock from this Magazyn?',
'NTC_REMOVE_INVITEE' => 'Are you sure you want to remove this contact from the Magazyn?',
'NTC_REMOVE_ACCOUNT_CONFIRMATION' => 'Are you sure you want to remove this ecmstock from this account?',
'ERR_DELETE_RECORD' => 'A record number must be specified to delete the stock.',
// FOR DEFAULT FIELDS
'LBL_NAME' => 'Nazwa:',
'LBL_SUBJECT' => 'Nazwa:',
'LBL_CREATED_BY' => 'Utworzone Przez:',
'LBL_CREATED' => 'Utworzone Przez:',
'LBL_ASSIGNED_TO' => 'Przypisane Do:',
'LBL_ASSIGNED_USER_ID' => 'Przypisane Do:',
'LBL_DATE_ENTERED' => 'Data Utworzenia:',
'LBL_DATE_CREATED' => 'Data Utworzenia:',
'LBL_DATE_MODIFIED' => 'Ostatnio Modyfikowane',
'LBL_MODIFIED_BY' => 'Ostatnio Modyfikowane Przez:',
'LBL_MODIFIED' => 'Modyfikowane Przez:',
'LBL_DATE_LAST_MODIFIED' => 'Data Modyfikacji:',
// FOR NEW FIELDS
'LBL_DESCRIPTION' => 'Opis',
// FOR GROUPS
'LBL_GROUP_MASTER' => 'INFORMACJE O MAGAZYNIE',
'LBL_GROUP_DESCRIPTION' => '',
// FOR SUBPANELS
'LBL_ECMSTOCKS_SUBPANEL_TITLE' => 'Magazyny',
'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Działania',
'LBL_HISTORY_SUBPANEL_TITLE' => 'Historia',
'LBL_ECMSTOCKS' => 'Magazyny',
// FOR MENU LABELS
'LNK_NEW_ECMSTOCKS' => 'Utwórz Magazyn',
'LNK_LIST_ECMSTOCK' => 'Lista Magazynów',
// FOR MENU LINKS
'LNK_NEW_ECMSTOCK' => 'Utwórz Magazyn',
'LNK_ECMSTOCKS_LIST' => 'Magazyny',
'LNK_ECMSTOCKS_REPORTS' => 'Magazyn Raport',
// FOR ADDITIONAL MENUS
// FOR DASHLETS
'LBL_LIST_ECMSTOCKS' => 'Magazyn',
);
?>

View File

@@ -0,0 +1,57 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$smarty->debugging = true;
$smarty->debugging_ctrl=($_SERVER['SERVER_NAME']=='localhost:8080')?'URL':'NONE';
$layout_defs['EcmStocks'] = array(
//LIST OF WHAT SUBPANELS TO SHOW IN THE DETAILVIEW
'subpanel_setup' => array(
),
);
?>

View File

@@ -0,0 +1,59 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$searchFields['EcmStocks'] =
array (
'name' => array('query_type' => 'default'),
'current_user_only'=> array('query_type' => 'default',
'db_field' => array('assigned_user_id'),
'my_items' => true
),
'assigned_user_id' => array('query_type' => 'default'),
);
?>

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
require_once('include/utils.php');
function additionalDetailsEcmStock($fields) {
static $mod_strings;
global $app_strings;
if(empty($mod_strings)) {
global $current_language;
$mod_strings = return_module_language($current_language, 'EcmStocks');
}
$overlib_string = '';
//BUILDER:START overlibstring
if(!empty($fields['DESCRIPTION'])){
$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> <BR>' . substr($fields['DESCRIPTION'], 0, 300);
if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
$overlib_string .= '<br>';
}
//BUILDER:END overlibstring
return array(
'fieldToAddTo' => 'NAME',
'string' => $overlib_string,
'editLink' => "index.php?action=EditView&module=EcmStocks&return_module=EcmStocks&record={$fields['ID']}",
'viewLink' => "index.php?action=DetailView&module=EcmStocks&return_module=EcmStocks&record={$fields['ID']}");
}
?>

View File

@@ -0,0 +1,84 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$listViewDefs['EcmStocks'] = array(
'NAME' => array(
'width' => '20',
'label' => 'LBL_NAME',
'default' => true,
'link' => true),
'DESCRIPTION' => array(
'width' => '10',
'label' => 'LBL_DESCRIPTION'),
'MAIN' => array(
'width' => '10',
'default'=>true,
'customCode'=>'{$MAIN}',
'label' => 'LBL_MAIN'),
'DATE_MODIFIED' => array(
'width' => '5',
'label' => 'LBL_DATE_MODIFIED'),
'DATE_ENTERED' => array(
'width' => '5',
'label' => 'LBL_DATE_ENTERED'),
'CREATED_BY_NAME' => array(
'width' => '10',
'label' => 'LBL_CREATED'),
'ASSIGNED_USER_NAME' => array(
'width' => '2',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true),
'MODIFIED_USER_NAME' => array(
'width' => '2',
'label' => 'LBL_MODIFIED')
);
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$popupMeta = array(
'moduleMain' => 'EcmStock',
'varName' => 'ECMSTOCK',
'orderBy' => 'ecmstocks.name',
'whereClauses' => array(
'name' => 'ecmstocks.name',
),
'searchInputs' => array('name', 'name')
);
?>

View File

@@ -0,0 +1,76 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$GLOBALS['studioDefs']['EcmStocks'] = array(
'LBL_DETAILVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStocks/DetailView.html',
'php_file' => 'modules/EcmStocks/DetailView.php',
'type' => 'DetailView',
),
'LBL_EDITVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStocks/EditView.html',
'php_file' => 'modules/EcmStocks/EditView.php',
'type' => 'EditView',
),
'LBL_LISTVIEW'=>array(
'template' => 'listview',
'meta_file' => 'modules/EcmStocks/listviewdefs.php',
'type' => 'ListView',
),
'LBL_SEARCHFORM'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStocks/SearchForm.html',
'php_file' => 'modules/EcmStocks/ListView.php',
'type' => 'SearchForm',
),
);

View File

@@ -0,0 +1,54 @@
<?
/*
$modules=array("EcmStocks","EcmPurchaseOrders","EcmStockDocIns","EcmSalesOrders","EcmStockDocOuts","EcmDeliveryNotes","EcmInvoiceOuts","EcmStockBookings");
foreach($modules as $module)
{
if($_REQUEST['module']==$module)
{
$modules[8]="EcmStockSettings";
break;
}
}
if(!$modules[8])
{
$modules[8]=$_REQUEST['module'];
if($_REQUEST['module']!="EcmStockBookings")$mmodules[]="EcmStockSettings";
}
$more_modules=array();
for($i=0;$i<count($more_modules);$i++)
{
if($more_modules[$i]==$_REQUEST['module'])continue;
else $mmodules[]=$more_modules[$i];
}
$more_modules=$mmodules;
print '<ul class="tablist">';
foreach($modules as $module)
{
include("modules/".$module."/language/en_us.lang.php");
if(ACLController::checkAccess($module, 'list', true))
{
if($_REQUEST['module']==$module)
{
$class1=' class="active"';
$class2=' class="current"';
}
else
{
$class1='';
$class2='';
}
print '<li'.$class1.'><a'.$class2.' href="index.php?module='.$module.'&action=index">'.$mod_strings['LNK_'.strtoupper($module).'_LIST'].'</a></li>';
}
}
print '<li id="MoreHandle1" style="cursor: pointer; cursor: hand;" onMouseOver="tbButtonMouseOver(this.id,156,\'\',-1);"><a>&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;</a></li></ul><br><div id="MoreMenu1" class="menu" onMouseOver="window.clearTimeout(SUGAR.themes.resetSubTabsTimer);" onMouseOut="SUGAR.themes.setResetTimer();">';
foreach($more_modules as $more_module)
{
include("modules/".$more_module."/language/en_us.lang.php");
print '<a href="index.php?module='.$more_module.'&action=index" class="menuItem" id="'.$more_module.'Handle" parentid="MoreMenu1" onMouseOver="hiliteItem(this,\'yes\');SUGAR.themes.updateSubTabsDelay(SUGAR.themes.moreTab,\'{{MODULE_NAME|htmlspecialchars}\',\'{MODULE_NAME|htmlspecialchars}\');closeSubMenus(this);" onMouseOut="unhiliteItem(this);" onClick="SUGAR.themes.chooseTab(\''.$more_module.'\'); return true;">'.$mod_strings['LNK_'.strtoupper($more_module).'_LIST'].'</a>';
}
print '</ul></div><br>';
include("modules/".$_REQUEST['module']."/language/en_us.lang.php");*/
?>

View File

@@ -0,0 +1,10 @@
<?
$modules=array("EcmStocks","EcmPurchaseOrders","EcmSalesOrders","EcmInvoiceOuts","EcmDeliveryNotes");
foreach($modules as $module)
{
include("modules/".$module."/language/en_us.lang.php");
if(ACLController::checkAccess($module, 'edit', true))$module_menu [] = Array("index.php?module=".$module."&action=EditView&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_NEW_'.strtoupper($module)],"");
//if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=index&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_'.strtoupper($module).'_LIST'],"List".$module, $module);
}
include("modules/".$_REQUEST['module']."/language/en_us.lang.php");
?>

38
modules/EcmStocks/q.php Executable file
View File

@@ -0,0 +1,38 @@
<?
if($_GET['stock_id'])$stock=" and stock_id='".$_GET['stock_id']."'";
else $stock="";
/*$z="select * from ecmstockoperations where deleted='0' and product_id='".$_GET['id']."'".$stock;
$w=$GLOBALS['db']->query($z);
$total=0;
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
if($r['type']=="0" || $r['type']=="2")$total+=$r['quantity'];
elseif($r['type']=="1") $total-=$r['quantity'];
}*/
$q1=0;
$w=$GLOBALS['db']->query("select quantity as qty,id,price,product_id from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL".$stock." and product_id='".$_GET['id']."'");
while($rrr=$GLOBALS['db']->fetchByAssoc($w)){
print $rrr['product_id'].'<br>';
$ww=$GLOBALS['db']->query("select quantity from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL".$stock." and product_id='".$_GET['id']."' and deleted='0'");
$rqty=0;
while($rrp=$GLOBALS['db']->fetchByAssoc($ww)){
$rqty+=$rrp['quantity'];
}
$qty=$rrr['qty']-$rqty;
if($qty>0){
$arr[]=array("qty"=>$qty,"id"=>$rrr['id'],"price"=>$rrr['price']);
}
}
echo '<pre>';
print_r($arr);
echo '</pre>';
if(count($arr)>0){
foreach($arr as $v){
$q1+=$v['qty'];
$pp1+=$v['qty']*$v['price'];
}
}
print $q1;
?>

5
modules/EcmStocks/setMain.php Executable file
View File

@@ -0,0 +1,5 @@
<?
$GLOBALS['db']->query("update ecmstocks set main='0'");
$GLOBALS['db']->query("update ecmstocks set main='1' where id='".$_REQUEST['record']."'");
header("Location: index.php?module=EcmStocks&action=index");
?>

View File

@@ -0,0 +1,82 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmStocks'),
),
'where' => '',
'list_fields' => array(
'name'=>array(
'vname' => 'LBL_LIST_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '50%',
),
'assigned_user_name' => array (
'name' => 'assigned_user_name',
'vname' => 'LBL_LIST_ASSIGNED_TO_NAME',
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmStocks',
'width' => '4%',
),
'remove_button'=>array(
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmStocks',
'width' => '5%',
),
),
);
?>

288
modules/EcmStocks/vardefs.php Executable file
View File

@@ -0,0 +1,288 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* ***************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License.
* You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
* ******************************************************************************
*/
$dictionary ['EcmStock'] = array (
'table' => 'ecmstocks',
'audited' => true,
'comment' => 'EcmStocks',
'duplicate_merge' => true,
'unified_search' => true,
'fields' => array (
// STANDARD FIELDS SECTION
'id' => array (
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => true,
'reportable' => false,
'comment' => 'Unique identifier'
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_NAME',
'type' => 'name',
'required' => true,
'dbType' => 'varchar',
'len' => 255,
'audited' => true,
'unified_search' => true,
'comment' => 'The short description of the record contents',
'massupdate' => true,
'merge_filter' => 'selected'
),
'date_entered' => array (
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'required' => true,
'comment' => 'Date record created'
),
'date_modified' => array (
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'required' => true,
'comment' => 'Date record last modified'
),
'modified_user_id' => array (
'name' => 'modified_user_id',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_MODIFIED',
'type' => 'assigned_user_name',
'table' => 'modified_user_id_users',
'isnull' => 'false',
'dbType' => 'varchar',
'len' => 36,
'required' => true,
'reportable' => true,
'comment' => 'User who last modified record'
),
'assigned_user_id' => array (
'name' => 'assigned_user_id',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'vname' => 'LBL_ASSIGNED_TO',
'type' => 'relate',
'table' => 'users',
'isnull' => 'false',
'dbType' => 'varchar',
'reportable' => true,
'len' => 36,
'audited' => true,
'comment' => 'User assigned to record',
'module' => 'Users',
'duplicate_merge' => 'disabled'
)
,
'assigned_user_name' => array (
'name' => 'assigned_user_name',
'vname' => 'LBL_ASSIGNED_TO',
'type' => 'varchar',
'reportable' => false,
'source' => 'nondb',
'table' => 'users',
'massupdate' => true,
'duplicate_merge' => 'disabled'
),
'created_by' => array (
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'created_by',
'vname' => 'LBL_CREATED',
'type' => 'assigned_user_name',
'table' => 'created_by_users',
'isnull' => 'false',
'dbType' => 'varchar',
'len' => 36,
'comment' => 'User that created the record'
),
'created_by_link' => array (
'name' => 'created_by_link',
'type' => 'link',
'relationship' => 'ecmstocks_created_by',
'vname' => 'LBL_CREATED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db'
),
'modified_user_link' => array (
'name' => 'modified_user_link',
'type' => 'link',
'relationship' => 'ecmstocks_modified_user',
'vname' => 'LBL_MODIFIED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db'
),
'assigned_user_link' => array (
'name' => 'assigned_user_link',
'type' => 'link',
'relationship' => 'ecmstocks_assigned_user',
'vname' => 'LBL_ASSIGNED_TO_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
'duplicate_merge' => 'enabled',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'table' => 'users'
),
'deleted' => array (
'name' => 'deleted',
'vname' => 'LBL_CREATED_BY',
'type' => 'bool',
'required' => true,
'reportable' => false,
'comment' => 'Record deletion indicator'
),
// NEW FIELDS SECTION
'description' => array (
'type' => 'text',
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'comment' => 'Description',
'unified_search' => true
),
'main' => array (
'type' => 'bool',
'name' => 'main',
'vname' => 'LBL_MAIN',
'comment' => 'Main',
'unified_search' => true
),
'dir' => array (
'type' => 'varchar',
'name' => 'dir',
'vname' => 'LBL_DIR',
'comment' => 'Dir',
'unified_search' => true
),
'no' => array (
'type' => 'varchar',
'len' => '10',
'name' => 'no',
'vname' => 'LBL_NO',
'unified_search' => true
),
'default_bank_id' => array (
'type' => 'varchar',
'len' => '36',
'name' => 'default_bank_id',
'vname' => 'Domyślny numer bankowy',
'unified_search' => false
),
)
// FOR SUBPANELS
,
// INDICES SECTION
'indices' => array (
array (
'name' => 'ecmstocksspk',
'type' => 'primary',
'fields' => array (
'id'
)
),
array (
'name' => 'idx_ecmstocks_name',
'type' => 'index',
'fields' => array (
'name'
)
)
),
// RELATIONSHIPS SECTION
'relationships' => array (
'ecmstocks_assigned_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmStocks',
'rhs_table' => 'ecmstocks',
'rhs_key' => 'assigned_user_id',
'relationship_type' => 'one-to-many'
),
'ecmstocks_modified_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmStocks',
'rhs_table' => 'ecmstocks',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many'
),
'ecmstocks_created_by' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmStocks',
'rhs_table' => 'ecmstocks',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many'
)
)
,
// THIS FLAG ENABLES OPTIMISTIC LOCKING FOR SAVES FROM EDITVIEW
'optimistic_locking' => true
);
?>