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,67 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class AccountsParseRule extends BaseRule {
function AccountsParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^parent_id$/')) {
$panels[$name][$rowCount][$key] = 'parent_name';
} else if($this->matches($column, '/_address_(street|country)$/') && is_array($column) && isset($column['customCode'])) {
if(preg_match('/\{\$fields\.push_contacts_(billing|register)\.value\}/', $column['customCode'], $m)) {
$column['customCode'] = str_replace('{$fields.push_contacts_'. $m[1].'.value}', '{$custom_code_'.$m[1].'}', $column['customCode']);
$panels[$name][$rowCount][$key] = $column;
}
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class ActivitiesParseRule extends BaseRule {
function ActivitiesParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^duration_minutes$/')) {
$panels[$name][$rowCount][$key] = 'duration_hours';
} else if($this->matches($column, '/^time_start$/')) {
$panels[$name][$rowCount][$key] = 'date_start';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
function parsePanels($panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^duration_minutes$/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
}
?>

View File

@@ -0,0 +1,153 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* AddressRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules. Address fields defined in the
* address panel will be removed as the new metadata definition will be merged later.
* If the address fields are outside the address panel, we will keep them as is, but
* ensure that they are not defined as Arrays.
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class AddressRule extends BaseRule {
function AddressRule() {
}
function parsePanels($panels, $view) {
$searchedAddressPanel = array();
foreach($panels as $name=>$panel) {
$isAddressPanel = $name == 'lbl_address_information';
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/_address_(city|state|country|postalcode)$/si')) {
if($view == 'DetailView' && !is_array($column)) {
$panels[$name][$rowCount][$key] = '';
} else if($view == 'DetailView' && $this->matches($column, '/_address_country$/') && is_array($column)) {
$match = $this->getMatch($column, '/(.*?)_address_country$/');
$panels[$name][$rowCount][$key]['name'] = $match[1] . '_address_street';
$panels[$name][$rowCount][$key]['label'] = 'LBL_' . strtoupper($match[1]) . '_ADDRESS';
} else if($view == 'EditView' && $isAddressPanel) {
$field = is_array($column) ? $column['name'] : $column;
preg_match('/^(.*?)_address_/si', $field, $matches);
if(empty($searchedAddressPanel[$matches[1]])) {
$intact = $this->hasAddressFieldsIntact($panel, $matches[1]);
//now we actually have to go back in and replace the street field
if(!$intact) {
$panels = $this->removeStreetFieldOverride($panels, $matches[1]);
}
$addressFieldsIntact[$matches[1]] = $intact;
$searchedAddressPanel[$matches[1]] = true;
}
//Only remove in address panel if the street field is in there by itself
if($addressFieldsIntact[$matches[1]]) {
$panels[$name][$rowCount][$key] = '';
}
}
} else if($this->matches($column, '/^push_.*?_(register|billing)$/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
/**
* hasAddressFieldsIntact
* This function checks to see if the address fields for the given street key is
* intact. This means that all five fields (street, city, state, country and postalcode)
* have not been moved from the address panel
*
* @param $addressPanel Array of address panel contents
* @param $suffix The address suffix (billing, register, primary, alternate) to check for
* @return boolean
*/
function hasAddressFieldsIntact($addressPanel, $suffix) {
$expression = '/^' . $suffix . '_address_(street|city|state|country|postalcode)$/si';
$count = 0;
foreach($addressPanel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, $expression)) {
$count++;
}
}
}
return $count == 5;
}
/**
* removeStreetFieldOverride
* This function scans the panels and locates the street address field for the given key
* and replaces the Array definition (from the merging process) with a String value.
* @param $panels Array of the view's panels
* @param $street String key value of the street to search for
* @returns $panels Array of view's panels with street value substituted
*/
function removeStreetFieldOverride($panels, $street) {
$expression = '/^' . $street . '_address_street$/si';
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, $expression)) {
$panels[$name][$rowCount][$key] = $street . '_address_street';
}
}
}
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,94 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* BaseRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules.
* @author Collin Lee
*/
class BaseRule {
function BaseRule() {
}
function preParse($panels, $view) {
return $panels;
}
function postParse($panels, $view) {
return $this->parsePanels($panels, $view);
}
function parsePanels($panels, $view) {
return $panels;
}
function isCustomField($mixed) {
if(is_array($mixed) && isset($mixed['name']) && preg_match('/.*?_c$/s', $mixed['name'])) {
return true;
} else if(!is_array($mixed) && isset($mixed) && preg_match('/.*?_c$/s', $mixed)) {
return true;
}
return false;
}
function matches($mixed, $regExp) {
if(is_array($mixed) && isset($mixed['name']) && preg_match($regExp, $mixed['name'])) {
return true;
} else if(!is_array($mixed) && isset($mixed) && preg_match($regExp, $mixed)) {
return true;
}
return false;
}
function getMatch($mixed, $regExp) {
if(is_array($mixed) && isset($mixed['name']) && preg_match($regExp, $mixed['name'], $matches)) {
return $matches;
} else if(!is_array($mixed) && isset($mixed) && preg_match($regExp, $mixed, $matches)) {
return $matches;
}
return null;
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class BugsParseRule extends BaseRule {
function BugsParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^release$/')) {
$panels[$name][$rowCount][$key] = 'found_in_release';
}
} //foreach
} //foreach
} //foreach
} //if
return $panels;
}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/ActivitiesParseRule.php');
class CallsParseRule extends ActivitiesParseRule {
function CallsParseRule() {
}
function preParse($panels, $view) {
$panels = parent::preParse($panels, $view);
if($view == 'EditView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^direction$/si')) {
$panels[$name][$rowCount][$key] = 'status';
}
} //foreach
} //foreach
} //foreach
} //if
return $panels;
}
function parsePanels($panels, $view) {
$panels = parent::parsePanels($panels, $view);
return $panels;
}
}
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class CampaignsParseRule extends BaseRule {
function CampaignsParseRule() {
}
function preParse($panels, $view) {
if($view == 'EditView') {
$frequencyAdded = false;
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if(empty($column) && !$frequencyAdded) {
//Add the frequency label
$panels[$name][$rowCount][$key] = 'frequency';
$frequencyAdded = true;
} else if($this->matches($column, '/^deleted$/')) {
//This is to fix the error where the Created By field
//in Campaigns EditView.html actually references the deleted field
//We will just remove the field since you shouldn't be able to edit this information anyway
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
//If all the row/columns were taken up, then add frequency as a last row
if(!$frequencyAdded) {
$panels['default'][][] = 'frequency';
}
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,81 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class ContactsParseRule extends BaseRule {
function ContactsParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^(last_)?name$/')) {
$panels[$name][$rowCount][$key] = 'full_name';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
function parsePanels(& $panels, $view) {
if($view == 'EditView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/portal_password1/si')) {
$panels[$name][$rowCount][$key] = array('name'=>'portal_password1', 'type'=>'password', 'customCode'=>'<input id="portal_password1" name="portal_password1" type="password" size="32" maxlength="32" value="{$fields.portal_password.value}">', 'label'=>'LBL_PORTAL_PASSWORD');
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class ContractsParseRule extends BaseRule {
function ContractsParseRule() {
}
function preParse($panels, $view) {
if($view == 'EditView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^expiration_notice_date$/')) {
$panels[$name][$rowCount][$key] = 'expiration_notice';
}
} //foreach
} //foreach
} //foreach
} //if
return $panels;
}
}
?>

View File

@@ -0,0 +1,96 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class DocumentsParseRule extends BaseRule {
function DocumentsParseRule() {
}
function preParse($panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^related_doc_id$/')) {
$panels[$name][$rowCount][$key] = 'related_doc_name';
} else if($this->matches($column, '/^related_doc_rev_id$/')) {
$panels[$name][$rowCount][$key] = ($view == 'EditView') ? 'related_doc_rev_number' : 'related_doc_name';
} else if($this->matches($column, '/^user_date_format$/')) {
$panels[$name][$rowCount][$key] = 'active_date';
} else if($this->matches($column, '/^is_template_checked$/')) {
$panels[$name][$rowCount][$key] = 'is_template';
} else if($this->matches($column, '/^last_rev_creator$/')) {
$panels[$name][$rowCount][$key] = 'last_rev_created_name';
} else if($this->matches($column, '/^last_rev_date$/')) {
$panels[$name][$rowCount][$key] = 'last_rev_create_date';
} else if($this->matches($column, '/^save_file$/')) {
$panels[$name][$rowCount][$key] = 'filename';
} else if($this->matches($column, '/^subcategory$/')) {
$panels[$name][$rowCount][$key] = 'subcategory_id';
} else if($this->matches($column, '/^category$/')) {
$panels[$name][$rowCount][$key] = 'category_id';
} else if($this->matches($column, '/^related_document_version$/')) {
$panels[$name][$rowCount][$key] = 'related_doc_rev_number';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
function parsePanels(& $panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/related_doc_id/si') ||
$this->matches($column, '/related_doc_rev_id/si') ||
$this->matches($column, '/latest_revision/si') ||
$this->matches($column, '/file_name/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
}
?>

View File

@@ -0,0 +1,121 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* EmailAddressRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules. We basically scan for email1 or
* email2 defined outside of the email address panel and remove it.
*
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class EmailAddressRule extends BaseRule {
function EmailAddressRule() {
}
function parsePanels(& $panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
if(preg_match('/lbl_email_addresses/si', $name)) {
continue;
}
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->isCustomField($column)) {
continue;
} else if(is_array($column) && !empty($column['name']) && preg_match('/^email(s|2)$/si', $column['name']) && !isset($column['type'])) {
$panels[$name][$rowCount][$key] = '';
} else if($this->matches($column, '/^email[1]_link$/si')) {
$panels[$name][$rowCount][$key] = 'email1';
} else if($this->matches($column, '/^email[2]_link$/si')) {
$panels[$name][$rowCount][$key] = '';
} else if(!is_array($column) && !empty($column)) {
if(preg_match('/^email(s|2)$/si', $column) ||
preg_match('/^invalid_email$/si', $column) ||
preg_match('/^email_opt_out$/si', $column) ||
preg_match('/^primary_email$/si', $column)) {
$panels[$name][$rowCount][$key] = '';
}
}
} //foreach
} //foreach
} //foreach
} else if($view == 'EditView') {
foreach($panels as $name=>$panel) {
if(preg_match('/lbl_email_addresses/si', $name)) {
continue;
}
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->isCustomField($column)) {
continue;
}
if($this->matches($column, '/email(s)*?([1|2])*?/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,90 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* EmptyRowRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules. This rule goes through the panels
* and deletes rows for which there are no fields.
*
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class EmptyRowRule extends BaseRule {
function EmptyRowRule() {
}
function parsePanels($panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
$emptyCount = 0;
foreach($row as $key=>$column) {
if(is_array($column) && (!isset($column['name']) || empty($column['name']))) {
$emptyCount++;
} else if(!is_array($column) && (!isset($column) || empty($column))) {
$emptyCount++;
}
} //foreach
// If we have unset everything, then just remove the whole row entirely
if($emptyCount == count($row)) {
unset($panels[$name][$rowCount]);
continue;
} else if(count($row) > 2) {
foreach($row as $key=>$column) {
if(empty($column) || $column == '') {
unset($panels[$name][$rowCount][$key]);
}
}
}
} //foreach
} //foreach
return $panels;
}
}
?>

View File

@@ -0,0 +1,65 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class LeadsParseRule extends BaseRule {
function LeadsParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^lead_view_c$/')) {
$panels[$name][$rowCount][$key] = 'full_name';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/ActivitiesParseRule.php');
class MeetingsParseRule extends ActivitiesParseRule {
function MeetingsParseRule() {
}
function preParse($panels, $view) {
$panels = parent::preParse($panels, $view);
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
//Fix issue of not having parent_name in Meetings vardefs.php in pre 5.x versions
if($this->matches($column, '/^tag.parent$/') || $this->matches($column, '/^parent_id$/')) {
$panels[$name][$rowCount][$key] = 'parent_name';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class NotesParseRule extends BaseRule {
function NotesParseRule() {
}
function preParse($panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^related_doc_id$/')) {
$panels[$name][$rowCount][$key] = 'related_doc_name';
} else if($this->matches($column, '/^related_doc_rev_id$/')) {
$panels[$name][$rowCount][$key] = ($view == 'EditView') ? 'related_doc_rev_number' : 'related_doc_name';
} else if($this->matches($column, '/^filelink$/')) {
$panels[$name][$rowCount][$key] = 'filename';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class OpportunitiesParseRule extends BaseRule {
function OpportunitiesParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if ($this->matches($column, '/^type$/i')) {
$panels[$name][$rowCount][$key] = 'opportunity_type';
}
} //foreach
} //foreach
} //foreach
} //if
return $panels;
}
}
?>

View File

@@ -0,0 +1,70 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* ParseRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules.
* @author Collin Lee
*/
class ParseRules {
function ParseRules() {
}
/**
* getRules
* Return Array of rules to run
*
*/
function getRules() {
$rules = array();
$rules[] = array("class"=>"UndefinedVardefRule", "file"=>"include/SugarFields/Parsers/Rules/UndefinedVardefRule.php");
$rules[] = array("class"=>"VariableCleanupRule", "file"=>"include/SugarFields/Parsers/Rules/VariableCleanupRule.php");
$rules[] = array("class"=>"VariableSubstitutionRule", "file"=>"include/SugarFields/Parsers/Rules/VariableSubstitutionRule.php");
$rules[] = array("class"=>"AddressRule", "file"=>"include/SugarFields/Parsers/Rules/AddressRule.php");
$rules[] = array("class"=>"EmailAddressRule", "file"=>"include/SugarFields/Parsers/Rules/EmailAddressRule.php");
$rules[] = array("class"=>"EmptyRowRule", "file"=>"include/SugarFields/Parsers/Rules/EmptyRowRule.php");
return $rules;
}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class ProductsParseRule extends BaseRule {
function ProductsParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if ($this->matches($column, '/^url$/i')) {
$panels[$name][$rowCount][$key] = 'website';
} else if ($this->matches($column, '/^manufacturer$/i')) {
$panels[$name][$rowCount][$key] = 'manufacturer_name';
} else if ($this->matches($column, '/^category$/i')) {
$panels[$name][$rowCount][$key] = 'category_name';
} else if ($this->matches($column, '/^type$/i')) {
$panels[$name][$rowCount][$key] = 'type_name';
}
} //foreach
} //foreach
} //foreach
} //if
return $panels;
}
}
?>

View File

@@ -0,0 +1,130 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class QuotesParseRule extends BaseRule {
function QuotesParseRule() {
}
function preParse($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
if($name == 'default') {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/billing_address_country/')) {
$column['label'] = 'LBL_BILL_TO';
$column['name'] = 'billing_address_street';
$panels[$name][$rowCount][$key] = $column;
} else if($this->matches($column, '/register_address_country/')) {
$column['label'] = 'LBL_SHIP_TO';
$column['name'] = 'register_address_street';
$panels[$name][$rowCount][$key] = $column;
} else if($this->matches($column, '/^date_quote_closed$/')) {
$panels[$name][$rowCount][$key] = 'date_quote_expected_closed';
} else if($this->matches($column, '/^tag\.opportunity$/')) {
$panels[$name][$rowCount][$key] = 'opportunity_name';
}
} //foreach
} //foreach
} //if
} //foreach
}
if($view == 'EditView') {
$processedBillToPanel = false;
foreach($panels as $name=>$panel) {
// This panel is an exception in that it has nested tables...
if($name == 'lbl_bill_to' && !$processedBillToPanel) {
$billToPanel = $panel;
$newBillPanel = array();
foreach($billToPanel as $subpanel) {
$col = array();
foreach($subpanel as $rowCount=>$row) {
if(!is_array($row)) {
if(!$this->matches($row, '/^(register|billing)_address_(street|city|state|country|postalcode)$/si')) {
$col[] = $row;
}
} else {
foreach($row as $key=>$column) {
if(is_array($column)) {
continue;
}
if($this->matches($column, '/^(billing|register)_(account|contact)_name$/')) {
$match = $this->getMatch($column, '/^(billing|register)_(account|contact)_name$/');
$col[$match[0]] = $match[0];
} else if(!$this->matches($column, '/^(register|billing)_address_(street|city|state|country|postalcode)$/si')) {
$col[] = $column;
}
} //foreach
}
} //foreach
if(!empty($col)) {
$newBillPanel[] = $col;
}
} //foreach
$panels['lbl_bill_to'] = $newBillPanel;
$processedBillToPanel = true;
continue;
} //if
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
//We are just going to clean up address fields since we have
//to insert a new address panel anyway
if($this->matches($column, '/^(register|billing)_address_(street|city|state|country|postalcode)$/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* UndefinedVardefRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules.
*
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class UndefinedVardefRule extends BaseRule {
function UndefinedVardefRule() {
}
function parsePanels($panels, $view) {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if(is_array($column) && isset($column['name']) && empty($column['name'])) {
$panels[$name][$rowCount][$key] = '';
} else if(!is_array($column) && isset($column['name']) && empty($column['name'])) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
return $panels;
}
}
?>

View File

@@ -0,0 +1,105 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* VariableCleanupRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules.
*
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class VariableCleanupRule extends BaseRule {
function VariableCleanupRule() {
}
function parsePanels($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
//This converts variable ended with "_c_checked" to just "_c" (for checkboxes in DetailView)
if(!is_array($column) && isset($column) && preg_match('/(.*?)_c_checked$/s', $column, $matches)) {
if(count($matches) == 2) {
$panels[$name][$rowCount][$key] = $matches[1] . "_c";
}
} else if($this->matches($column, '/^parent_id$/si')) {
$panels[$name][$rowCount][$key] = '';
} else if($this->matches($column, '/^assigned_user_id$/si')) {
$panels[$name][$rowCount][$key] = '';
}
} //foreach
} //foreach
} //foreach
} else if ($view == 'EditView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^(.*?)_c\[\]$/s')) {
//This converts multienum variables named with [] suffix back to normal and removes custom code
$val = $this->getMatch($column, '/^(.*?)_c\[\]$/s');
$panels[$name][$rowCount][$key] = $val[1] . '_c';
} else if($this->matches($column, '/^parent_id$/si')) {
//Remove parent_id field (replaced with parent_name from master copy)
$panels[$name][$rowCount][$key] = '';
} else if($this->matches($column, '/^assigned_user_id$/si')) {
//Remove assigned_user_id field (replaced with assigned_user_name from master copy)
$panels[$name][$rowCount][$key] = '';
} else if($this->matches($column, '/^RADIOOPTIONS_/si')) {
//This converts radioenum variables
$val = $this->getMatch($column, '/^RADIOOPTIONS_(.*)?$/si');
$panels[$name][$rowCount][$key] = $val[1];
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>

View File

@@ -0,0 +1,136 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* VariableSubstitutionRule.php
*
* This is a utility base class to provide further refinement when converting
* pre 5.x files to the new meta-data rules. This rule substitutes the current
* definitions will the standard meta-data ones.
*
* @author Collin Lee
*/
require_once('include/SugarFields/Parsers/Rules/BaseRule.php');
class VariableSubstitutionRule extends BaseRule {
function VariableSubstitutionRule() {
}
function parsePanels($panels, $view) {
if($view == 'DetailView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^date_entered$/') || $this->matches($column, '/^created_by$/')) {
$panels[$name][$rowCount][$key] = array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
'label' => 'LBL_DATE_ENTERED',
);
} else if($this->matches($column, '/^team.*?(_name)?$/s')) {
$panels[$name][$rowCount][$key] = 'team_name';
} else if($this->matches($column, '/^date_modified$/') || $this->matches($column, '/^modified_by$/')) {
$panels[$name][$rowCount][$key] = array (
'name' => 'date_modified',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
'label' => 'LBL_DATE_MODIFIED',
);
} else if($this->matches($column, '/^assigned.*?(_to|_name|_link)$/s')) {
//Remove "assigned_to" variable... this will be replaced with "assigned_to"
$panels[$name][$rowCount][$key] = 'assigned_user_name';
} else if($this->matches($column, '/^vcard_link$/')) {
$panels[$name][$rowCount][$key] = array (
'name' => 'full_name',
'customCode' => '{$fields.full_name.value}&nbsp;&nbsp;<input type="button" class="button" name="vCardButton" value="{$MOD.LBL_VCARD}" onClick="document.vcard.submit();">',
'label' => 'LBL_NAME',
);
} else if($this->matches($column, '/^parent_type$/si')) {
$panels[$name][$rowCount][$key] = 'parent_name';
} else if($this->matches($column, '/^account_id$/')) {
$panels[$name][$rowCount][$key] = 'account_name';
} else if($this->matches($column, '/^contact_id$/')) {
$panels[$name][$rowCount][$key] = 'contact_name';
} else if($this->matches($column, '/^reports_to_id$/')) {
$panels[$name][$rowCount][$key] = 'report_to_name';
} else if($this->matches($column, '/^reminder_time$/')) {
$panels[$name][$rowCount][$key] = array(
'name'=>'reminder_checked',
'fields'=>array('reminder_checked', 'reminder_time')
);
} else if($this->matches($column, '/^currency(_name)*$/')) {
$panels[$name][$rowCount][$key] = 'currency_id';
} else if($this->matches($column, '/^quote_id$/')) {
$panels[$name][$rowCount][$key] = 'quote_name';
}
} //foreach
} //foreach
} //foreach
} else if($view == 'EditView') {
foreach($panels as $name=>$panel) {
foreach($panel as $rowCount=>$row) {
foreach($row as $key=>$column) {
if($this->matches($column, '/^salutation$/si') && is_array($column) && isset($column['fields']) && count($column['fields']) == 2) {
//Change salutation field to salutation + first_name'
$panels[$name][$rowCount][$key] = array (
'name' => 'first_name',
'customCode' => '{html_options name="salutation" options=$fields.salutation.options selected=$fields.salutation.value}&nbsp;<input name="first_name" size="25" maxlength="25" type="text" value="{$fields.first_name.value}">',
);
} else if($this->matches($column, '/^parent_type$/si')) {
$panels[$name][$rowCount][$key] = 'parent_name';
} else if($this->matches($column, '/^currency(_name)$/')) {
$panels[$name][$rowCount][$key] = 'currency_id';
} else if($this->matches($column, '/^quote_id$/')) {
$panels[$name][$rowCount][$key] = 'quote_name';
} else if($this->matches($column, '/^account_id$/')) {
$panels[$name][$rowCount][$key] = 'account_name';
} else if($this->matches($column, '/^contact_id$/')) {
$panels[$name][$rowCount][$key] = 'contact_name';
}
} //foreach
} //foreach
} //foreach
}
return $panels;
}
}
?>