init
This commit is contained in:
55
modules/Schedulers/Delete.php
Executable file
55
modules/Schedulers/Delete.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Schedulers/SchedulerDaemon.php');
|
||||
global $mod_strings;
|
||||
|
||||
|
||||
|
||||
$focus = new Scheduler();
|
||||
|
||||
if(!isset($_REQUEST['record']))
|
||||
sugar_die($mod_strings['ERR_DELETE_RECORD']);
|
||||
|
||||
$focus->mark_deleted($_REQUEST['record']);
|
||||
|
||||
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
|
||||
?>
|
||||
54
modules/Schedulers/DeleteScheduled.php
Executable file
54
modules/Schedulers/DeleteScheduled.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
|
||||
global $mod_strings;
|
||||
|
||||
|
||||
|
||||
$focus = new Job();
|
||||
|
||||
if(!isset($_REQUEST['record']))
|
||||
sugar_die($mod_strings['ERR_DELETE_RECORD']);
|
||||
|
||||
$focus->mark_deleted($_REQUEST['record']);
|
||||
|
||||
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
|
||||
?>
|
||||
112
modules/Schedulers/DetailView.html
Executable file
112
modules/Schedulers/DetailView.html
Executable file
@@ -0,0 +1,112 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description:
|
||||
* Created On: Sep 29, 2005
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): Chris Nojima
|
||||
********************************************************************************/
|
||||
-->
|
||||
|
||||
<!-- BEGIN: main -->
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<form action="index.php" method="post" name="DetailView" id="form">
|
||||
<input type="hidden" name="module" value="Schedulers">
|
||||
<input type="hidden" name="record" value="{ID}">
|
||||
<input type="hidden" name="isDuplicate" value=false>
|
||||
<input type="hidden" name="action">
|
||||
<input type="hidden" name="return_module">
|
||||
<input type="hidden" name="return_action">
|
||||
<input type="hidden" name="return_id">
|
||||
<input type="hidden" name="scheduler_id" value="{ID}">
|
||||
|
||||
<input title="{APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='Schedulers'; this.form.return_action.value='EditView'; this.form.return_id.value='{ID}'; this.form.action.value='EditView'" type="submit" name="Edit" value=" {APP.LBL_EDIT_BUTTON_LABEL} ">
|
||||
|
||||
<input title="{APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='Schedulers'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'" type="submit" name="Duplicate" value=" {APP.LBL_DUPLICATE_BUTTON_LABEL} ">
|
||||
|
||||
<input title="{APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='Schedulers'; this.form.return_action.value='ListView'; this.form.action.value='Delete'; return confirm('{APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value=" {APP.LBL_DELETE_BUTTON_LABEL} ">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table width="100%" border="0" cellspacing="{GRIDLINE}" cellpadding="0" class="detail view">
|
||||
{PAGINATION}
|
||||
<tr>
|
||||
<td width="15%" valign="top" scope="row"><slot>{MOD.LBL_JOB}</slot></td>
|
||||
<td width="35%" valign="top"><slot>{JOB} </slot></td>
|
||||
<td width="15%" valign="top" scope="row"><slot>{MOD.LBL_STATUS}</slot></td>
|
||||
<td width="35%" valign="top"><slot>{STATUS} </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_DATE_TIME_START}</slot></td>
|
||||
<td valign="top"><slot>{DATE_TIME_START} </slot></td>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_TIME_FROM}</slot></td>
|
||||
<td valign="top"><slot>{TIME_FROM} </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_DATE_TIME_END}</slot></td>
|
||||
<td valign="top"><slot>{DATE_TIME_END} </slot></td>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_TIME_TO}</slot></td>
|
||||
<td valign="top"><slot>{TIME_TO} </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_LAST_RUN}</slot></td>
|
||||
<td valign="top"><slot>{LAST_RUN} </slot></td>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_INTERVAL}</slot></td>
|
||||
<td valign="top"><slot>{JOB_INTERVAL} </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row"><slot>{MOD.LBL_CATCH_UP}</slot></td>
|
||||
<td valign="top"><slot>{CATCH_UP} </slot></td>
|
||||
<td valign="top" scope="row"><slot> </slot></td>
|
||||
<td valign="top"><slot> </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row"><slot>{APP.LBL_DATE_ENTERED} </slot></td>
|
||||
<td valign="top"><slot>{DATE_ENTERED} {APP.LBL_BY} {CREATED_BY} </slot></td>
|
||||
<td valign="top" scope="row"><slot>{APP.LBL_DATE_MODIFIED} </slot></td>
|
||||
<td valign="top"><slot>{DATE_MODIFIED} {APP.LBL_BY} {MODIFIED_BY} </slot></td>
|
||||
</tr>
|
||||
{PAGINATION}
|
||||
</table>
|
||||
|
||||
<!-- END: main -->
|
||||
134
modules/Schedulers/DetailView.php
Executable file
134
modules/Schedulers/DetailView.php
Executable file
@@ -0,0 +1,134 @@
|
||||
<?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/DetailView/DetailView.php');
|
||||
|
||||
global $mod_strings;
|
||||
global $app_strings;
|
||||
global $timedate;
|
||||
|
||||
/* start standard DetailView layout process */
|
||||
$GLOBALS['log']->info("Schedulers DetailView");
|
||||
$focus = new Scheduler();
|
||||
$focus->checkCurl();
|
||||
$detailView = new DetailView();
|
||||
$offset=0;
|
||||
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
|
||||
$result = $detailView->processSugarBean("SCHEDULER", $focus, $offset);
|
||||
if($result == null) {
|
||||
sugar_die($app_strings['ERROR_NO_RECORD']);
|
||||
}
|
||||
$focus=$result;
|
||||
} else {
|
||||
header("Location: index.php?module=Schedulers&action=index");
|
||||
}
|
||||
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
|
||||
$focus->id = "";
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module=Schedulers&action=index'>{$mod_strings['LBL_MODULE_TITLE']}</a>";
|
||||
$params[] = $focus->name;
|
||||
|
||||
echo getClassicModuleTitle("Schedulers", $params, true);
|
||||
|
||||
/* end standard DetailView layout process */
|
||||
|
||||
$focus->parseInterval();
|
||||
$focus->setIntervalHumanReadable();
|
||||
|
||||
|
||||
$xtpl = new XTemplate('modules/Schedulers/DetailView.html');
|
||||
// custom assigns
|
||||
$focus->date_time_end = empty($focus->date_time_end) ? 0 : $focus->date_time_end; // this value is often emtpy/null
|
||||
if(strtotime($focus->date_time_end) < strtotime('2016-01-01 00:00:00')) {
|
||||
$xtpl->assign('DATE_TIME_END', $mod_strings['LBL_PERENNIAL']);
|
||||
} elseif($focus->date_time_end != '') {
|
||||
$xtpl->assign('DATE_TIME_END', $mod_strings['LBL_PERENNIAL']);
|
||||
} else {
|
||||
$xtpl->assign('DATE_TIME_END', $focus->date_time_end);
|
||||
}
|
||||
if($focus->last_run != '') {
|
||||
$xtpl->assign('LAST_RUN', $focus->last_run);
|
||||
} else {
|
||||
$xtpl->assign('LAST_RUN', $mod_strings['LBL_NEVER']);
|
||||
}
|
||||
if($focus->time_from != '') {
|
||||
$xtpl->assign('TIME_FROM', $focus->time_from);
|
||||
} else {
|
||||
$xtpl->assign('TIME_FROM', $mod_strings['LBL_ALWAYS']);
|
||||
}
|
||||
if($focus->time_to != '') {
|
||||
$xtpl->assign('TIME_TO', $focus->time_to);
|
||||
} else {
|
||||
$xtpl->assign('TIME_TO', $mod_strings['LBL_ALWAYS']);
|
||||
}
|
||||
if($focus->catch_up == 1) {
|
||||
$xtpl->assign('CATCH_UP', $mod_strings['LBL_ALWAYS']);
|
||||
} else {
|
||||
$xtpl->assign('CATCH_UP', $mod_strings['LBL_NEVER']);
|
||||
}
|
||||
|
||||
$focus->created_by_name = get_assigned_user_name($focus->created_by);
|
||||
$focus->modified_by_name = get_assigned_user_name($focus->modified_user_id);
|
||||
|
||||
$xtpl->assign('MOD', $mod_strings);
|
||||
$xtpl->assign('APP', $app_strings);
|
||||
$xtpl->assign('CREATED_BY', $focus->created_by_name);
|
||||
$xtpl->assign('MODIFIED_BY', $focus->modified_by_name);
|
||||
$xtpl->assign('GRIDLINE', $gridline);
|
||||
$xtpl->assign('PRINT_URL', 'index.php?'.$GLOBALS['request_string']);
|
||||
$xtpl->assign('ID', $focus->id);
|
||||
$xtpl->assign('NAME', $focus->name);
|
||||
$xtpl->assign('JOB', $focus->job);
|
||||
$xtpl->assign('STATUS', isset($app_list_strings['scheduler_status_dom'][$focus->status]) ? $app_list_strings['scheduler_status_dom'][$focus->status] : $focus->status);
|
||||
$xtpl->assign('DATE_TIME_START', $focus->date_time_start);
|
||||
$xtpl->assign('DATE_ENTERED', $focus->date_entered);
|
||||
$xtpl->assign('DATE_MODIFIED', $focus->date_modified);
|
||||
$xtpl->assign('MODIFIED_USER_ID', $focus->modified_by_name);
|
||||
$xtpl->assign('CREATED_BY', $focus->created_by_name);
|
||||
$xtpl->assign('JOB_INTERVAL', $focus->intervalHumanReadable);
|
||||
|
||||
$xtpl->parse('main');
|
||||
$xtpl->out('main');
|
||||
|
||||
require_once('include/SubPanel/SubPanelTiles.php');
|
||||
$subpanel = new SubPanelTiles($focus, 'Schedulers');
|
||||
echo $subpanel->display();
|
||||
|
||||
//$focus->displayCronInstructions();
|
||||
?>
|
||||
385
modules/Schedulers/EditView.html
Executable file
385
modules/Schedulers/EditView.html
Executable file
@@ -0,0 +1,385 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
-->
|
||||
|
||||
<!-- BEGIN: main -->
|
||||
{ERROR_STRING}
|
||||
{ROLLOVER}
|
||||
<form name="EditView" id="EditView" method="GET" action="index.php">
|
||||
<input type="hidden" name="module" value="Schedulers">
|
||||
<input type="hidden" name="record" value="{ID}">
|
||||
<input type="hidden" name="action">
|
||||
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
|
||||
<input type="hidden" name="return_id" value="{RETURN_ID}">
|
||||
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
|
||||
<input type="hidden" name="use_adv" id="use_adv" value="{USE_ADV_BOOL}">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save'; return checkFormPre('EditView')" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
|
||||
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='index'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
|
||||
</td>
|
||||
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
|
||||
<td align='right'>{ADMIN_EDIT}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table cellspacing="1" cellpadding="0" border="0" class="edit view" width="100%">
|
||||
<tr>
|
||||
<th align="left" scope="row" colspan="4">
|
||||
<h4>{MOD.LBL_BASIC_OPTIONS}</h4>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="15%" scope="row"><slot>{MOD.LBL_NAME} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td width="35%"><slot><input name='name' tabindex='1' size='35' maxlength='50' type="text" value="{NAME}"></slot></td>
|
||||
<td width="15%" scope="row"><slot>{MOD.LBL_STATUS} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td width="35%"><slot><select name='status' tabindex='8'>{STATUS_OPTIONS}</select></slot></td>
|
||||
</tr><tr>
|
||||
<td scope="row"> </td>
|
||||
<td> </td>
|
||||
<td scope="row"> </td>
|
||||
<td> </td>
|
||||
</tr><tr>
|
||||
<td scope="row"><slot>{MOD.LBL_JOB} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td><slot><select name='job_function' tabindex='2' size='1'>{JOB_FUNCTION}</select></slot></td>
|
||||
<td colspan="2"><slot> OR <input name='job_url' tabindex='2' size='30' maxlength='255' type="text" value="{JOB_URL}"></td>
|
||||
|
||||
</tr><tr>
|
||||
<td scope="row"><slot>{MOD.LBL_INTERVAL} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td colspan="3"><slot>
|
||||
<div id="crontab" style="display:none;">
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="5"><slot>
|
||||
<a href="javascript:void(0);" onClick="toggleAdv('false');">{MOD.LBL_TOGGLE_BASIC}</a>
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot>{MOD.LBL_MINS}</slot></td>
|
||||
<td><slot>{MOD.LBL_HOURS}</slot></td>
|
||||
<td><slot>{MOD.LBL_DAY_OF_MONTH}</slot></td>
|
||||
<td><slot>{MOD.LBL_MONTHS}</slot></td>
|
||||
<td><slot>{MOD.LBL_DAY_OF_WEEK}</slot></td>
|
||||
</tr><tr>
|
||||
<td><slot><input name="mins" tabindex="3" maxlength="25" type="text" size="3" value="{MINS}"></slot></td>
|
||||
<td><slot><input name="hours" tabindex="4" maxlength="25" type="text" size="3" value="{HOURS}"></slot></td>
|
||||
<td><slot><input name="day_of_month" tabindex="5" maxlength="25" type="text" size="3" value="{DAY_OF_MONTH}"></slot></td>
|
||||
<td><slot><input name="months" tabindex="6" maxlength="25" type="text" size="3" value="{MONTHS}"></slot></td>
|
||||
<td><slot><input name="day_of_week" tabindex="7" maxlength="25" type="text" size="3" value="{DAY_OF_WEEK}"></slot></td>
|
||||
</tr><tr>
|
||||
<td colspan="5"><slot>
|
||||
<em>{MOD.LBL_CRONTAB_EXAMPLES}</em>
|
||||
</slot></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="simple">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td colspan=5><slot>
|
||||
<a href="javascript:void(0);" onClick="toggleAdv('false');">{MOD.LBL_TOGGLE_ADV}</a>
|
||||
</slot></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
{MOD.LBL_EVERY}
|
||||
<select name="basic_interval" {ONLY_ADV}>{BASIC_INTERVAL}</select>
|
||||
<select name="basic_period" {ONLY_ADV}>{BASIC_PERIOD}</select>
|
||||
</td>
|
||||
|
||||
|
||||
<td valign="top" width="25%">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="all" value="true" id="all" {ONLY_ADV} {ALL} onClick="allDays();"> <i>{MOD.LBL_ALL}</i></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="mon" value="true" id="mon" {ONLY_ADV} {MON}> {MOD.LBL_MON}</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="tue" value="true" id="tue" {ONLY_ADV} {TUE}> {MOD.LBL_TUE}</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="wed" value="true" id="wed" {ONLY_ADV} {WED}> {MOD.LBL_WED}</slot></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td valign="top" width="25%">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="thu" value="true" id="thu" {ONLY_ADV} {THU}> {MOD.LBL_THU}</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="fri" value="true" id="fri" {ONLY_ADV} {FRI}> {MOD.LBL_FRI}</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="sat" value="true" id="sat" {ONLY_ADV} {SAT}> {MOD.LBL_SAT}</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><slot><input type="checkbox" name="sun" value="true" id="sun" {ONLY_ADV} {SUN}> {MOD.LBL_SUN}</slot></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</slot></td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="advTable" style="display:none;">
|
||||
<br>
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
|
||||
<tr>
|
||||
<th align="left" scope="row" colspan="4">
|
||||
<h4>{MOD.LBL_ADV_OPTIONS}</h4>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" width="15%"><slot>{MOD.LBL_CATCH_UP}</slot></td>
|
||||
<td width="35%"><slot>
|
||||
<div id="rollover"><a href="#" class="rollover"><span>{MOD.LBL_CATCH_UP_WARNING}</span><img border="0" src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></a></div>
|
||||
<input name='catch_up' tabindex='16' type='checkbox' value='1' {CATCH_UP_CHECKED}>
|
||||
|
||||
</slot></td>
|
||||
<td scope="row" width="15%"> </td>
|
||||
<td width="35%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td scope="row"><slot>{MOD.LBL_DATE_TIME_START} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td><slot>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap><input name='date_start' id='jscal_start_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" tabindex='8' size='11' maxlength='10' type="text" value="{DATE_START}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{CALENDAR_DATEFORMAT}" id="start_date_jscal_trigger" align="absmiddle"> </td>
|
||||
<td nowrap><select name='time_hour_start' tabindex="9">{TIME_START_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_start' tabindex="10">{TIME_START_MINUTE_OPTIONS}</select>{TIME_MERIDIEM_START}</td>
|
||||
</tr><tr>
|
||||
<td nowrap><span class="dateFormat">{USER_DATEFORMAT}</span></td>
|
||||
<td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</slot></td>
|
||||
|
||||
<td scope="row"><slot>{MOD.LBL_TIME_FROM}</slot></td>
|
||||
<td><slot>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap><select name='time_hour_from' tabindex="15">{TIME_FROM_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_from' tabindex="16">{TIME_FROM_MIN_OPTIONS}</select>{TIME_MERIDIEM_FROM}</td>
|
||||
</tr><tr>
|
||||
<td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</slot></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{MOD.LBL_DATE_TIME_END}</slot></td>
|
||||
<td><slot>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap><input name='date_end' id='jscal_end_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" tabindex='12' size='11' maxlength='10' type="text" value="{DATE_END}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{CALENDAR_DATEFORMAT}" id="end_date_jscal_trigger" align="absmiddle"> </td>
|
||||
<td nowrap><select name='time_hour_end' tabindex="13">{TIME_END_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_end' tabindex="14">{TIME_END_MINUTE_OPTIONS}</select>{TIME_MERIDIEM_END}</td>
|
||||
</tr><tr>
|
||||
<td nowrap><span class="dateFormat">{USER_DATEFORMAT}</span></td>
|
||||
<td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</slot></td>
|
||||
|
||||
<td scope="row"><slot>{MOD.LBL_TIME_TO}</slot></td>
|
||||
<td><slot>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap><select name='time_hour_to' tabindex="17">{TIME_TO_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_to' tabindex="18">{TIME_TO_MIN_OPTIONS}</select>{TIME_MERIDIEM_TO}</td>
|
||||
</tr><tr>
|
||||
<td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</slot></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div style="padding-top:2px;">
|
||||
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save'; return checkFormPre('EditView')" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " />
|
||||
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='index'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} " />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "jscal_start_date", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "start_date_jscal_trigger", singleClick : true, step : 1
|
||||
});
|
||||
|
||||
Calendar.setup ({
|
||||
inputField : "jscal_end_date", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "end_date_jscal_trigger", singleClick : true, step : 1
|
||||
});
|
||||
|
||||
|
||||
// this will pop open the Advanced settings if the DATE_START field (required) is empty
|
||||
function checkFormPre(formId) {
|
||||
validateCronInterval(formId);
|
||||
var noError = check_form(formId);
|
||||
|
||||
if(noError) {
|
||||
return true;
|
||||
} else {
|
||||
toggleAdv('true');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function validateCronInterval(formId) {
|
||||
var fieldIsValid = function(value, min, max) {
|
||||
var inRange = function(value, min, max) {
|
||||
return (value >= min && value <= max);
|
||||
}
|
||||
//Check for *
|
||||
if (value == "*") {
|
||||
return true;
|
||||
}
|
||||
//Check for interval syntax
|
||||
var result = /^\*\/(\d+)$/.exec(value);
|
||||
if (result && result[0] && inRange(result[1], min, max)) {
|
||||
return true;
|
||||
}
|
||||
//Check for ranges/lists
|
||||
var sets = value.split(',');
|
||||
var valid = true;
|
||||
for (var i = 0; i < sets.length; i++) {
|
||||
result = /^(\d+)(-(\d+))?$/.exec(sets[i])
|
||||
if (!result || !result[0] || !inRange(result[1], min, max) || (result[3] && !inRange(result[3], min, max))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var cronFields = {
|
||||
mins: {min:0, max:59},
|
||||
hours: {min:0, max:23},
|
||||
day_of_month: {min:1, max:31},
|
||||
months: {min:1, max:12},
|
||||
day_of_week: {min:0, max:7}
|
||||
}
|
||||
var valid = true;
|
||||
for (field in cronFields) {
|
||||
removeFromValidate(formId, field);
|
||||
if (document[formId][field] && !fieldIsValid(document[formId][field].value, cronFields[field].min, cronFields[field].max)) {
|
||||
valid = false;
|
||||
addToValidate(formId, field, 'error', true, "{MOD.ERR_CRON_SYNTAX}");
|
||||
} else {
|
||||
addToValidate(formId, field, 'verified', true, "{MOD.ERR_CRON_SYNTAX}");
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
function toggleAdv(onlyAdv) {
|
||||
var thisForm = document.getElementById("EditView");
|
||||
var crontab = document.getElementById("crontab");
|
||||
var simple = document.getElementById("simple");
|
||||
var adv = document.getElementById("advTable");
|
||||
var use = document.getElementById("use_adv");
|
||||
|
||||
if(crontab.style.display == "none" || onlyAdv == 'true') { // show advanced
|
||||
crontab.style.display = "";
|
||||
adv.style.display = "";
|
||||
simple.style.display = "none";
|
||||
use.value = "true";
|
||||
} else {
|
||||
crontab.style.display = "none";
|
||||
adv.style.display = "none";
|
||||
simple.style.display = "";
|
||||
use.value = "false";
|
||||
}
|
||||
|
||||
for(i=0; i<thisForm.elements.length; i++) {
|
||||
if(thisForm.elements[i].disabled) {
|
||||
thisForm.elements[i].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function allDays() {
|
||||
var toggle = document.getElementById("all");
|
||||
var m = document.getElementById("mon");
|
||||
var t = document.getElementById("tue");
|
||||
var w = document.getElementById("wed");
|
||||
var h = document.getElementById("thu");
|
||||
var f = document.getElementById("fri");
|
||||
var s = document.getElementById("sat");
|
||||
var u = document.getElementById("sun");
|
||||
|
||||
if(toggle.checked) {
|
||||
m.checked = true;
|
||||
t.checked = true;
|
||||
w.checked = true;
|
||||
h.checked = true;
|
||||
f.checked = true;
|
||||
s.checked = true;
|
||||
u.checked = true;
|
||||
} else {
|
||||
m.checked = false;
|
||||
t.checked = false;
|
||||
w.checked = false;
|
||||
h.checked = false;
|
||||
f.checked = false;
|
||||
s.checked = false;
|
||||
u.checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
{JAVASCRIPT}
|
||||
<!-- END: main -->
|
||||
346
modules/Schedulers/EditView.php
Executable file
346
modules/Schedulers/EditView.php
Executable file
@@ -0,0 +1,346 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
global $current_user;
|
||||
if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
|
||||
|
||||
$_REQUEST['edit']='true';
|
||||
|
||||
|
||||
$header_text = '';
|
||||
global $mod_strings;
|
||||
global $app_list_strings;
|
||||
global $app_strings;
|
||||
global $current_user;
|
||||
global $timedate;
|
||||
|
||||
$email = new Email();
|
||||
|
||||
/* Start standard EditView setup logic */
|
||||
$mod_strings = return_module_language($current_language, 'Schedulers');
|
||||
$focus = new Scheduler();
|
||||
$focus->checkCurl();
|
||||
if(isset($_REQUEST['record'])) {
|
||||
$GLOBALS['log']->debug("In Scheduler edit view, about to retrieve record: ".$_REQUEST['record']);
|
||||
$result = $focus->retrieve($_REQUEST['record']);
|
||||
if($result == null)
|
||||
{
|
||||
sugar_die($app_strings['ERROR_NO_RECORD']);
|
||||
}
|
||||
}
|
||||
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
|
||||
$GLOBALS['log']->debug("isDuplicate found - duplicating record of id: ".$focus->id);
|
||||
$focus->id = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module=Schedulers&action=index'>{$mod_strings['LBL_MODULE_TITLE']}</a>";
|
||||
if(empty($focus->id)){
|
||||
$params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
|
||||
}else{
|
||||
$params[] = "<a href='index.php?module=Schedulers&action=DetailView&record={$focus->id}'>{$focus->name}</a>";
|
||||
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
|
||||
}
|
||||
echo getClassicModuleTitle("Schedulers", $params, true);
|
||||
|
||||
$GLOBALS['log']->info("Scheduler Edit View");
|
||||
/* End standard EditView setup logic */
|
||||
|
||||
// javascript calls
|
||||
|
||||
$javascript = new javascript();
|
||||
$javascript->setSugarBean($focus);
|
||||
$javascript->setFormName('EditView');
|
||||
$javascript->addAllFields('');
|
||||
$javascript->addFieldGeneric('mins', 'alpha', 'Mins', true, $prefix='');
|
||||
$javascript->addFieldGeneric('hours', 'alpha', 'Hours', true, $prefix='');
|
||||
$javascript->addFieldGeneric('day_of_month', 'alpha', 'Days of Month', true, $prefix='');
|
||||
$javascript->addFieldGeneric('months', 'alpha', 'Months', true, $prefix='');
|
||||
$javascript->addFieldGeneric('day_of_week', 'alpha', 'Days of Week', true, $prefix='');
|
||||
$javascript->addFieldGeneric('date_start', 'date', 'Start Date', true, $prefix='');
|
||||
//$javascript->addFieldDateBeforeAllowBlank('date_start', 'date', 'Date End', 'false', $prefix='', 'date_end', 'true'); // cn: disabled because it does not handle user-pref date format
|
||||
$javascript->addToValidateBinaryDependency('time_hour_from', 'alpha', 'Active From (hr) must be set with Active To (hr) ', 'false', $prefix='', 'time_hour_to');
|
||||
$javascript->addToValidateBinaryDependency('time_minute_from', 'alpha', 'Active From (min) must be set with Active To (min) ', 'false', $prefix='', 'time_minute_to');
|
||||
//($field, $type,$displayName, $required, $prefix='',$compareTo)
|
||||
|
||||
// split the date/time of start/end
|
||||
$dtStart = $focus->date_time_start;
|
||||
$dtEnd = $focus->date_time_end;
|
||||
if(!empty($dtStart)) {
|
||||
$exStart = explode(" ",$dtStart);
|
||||
$date_start = $exStart[0];
|
||||
$time_start = $exStart[1];
|
||||
} else {
|
||||
$prefDate = $current_user->getUserDateTimePreferences();
|
||||
$date_start = date($prefDate['date'], strtotime('2005-01-01'));
|
||||
$time_start = '';
|
||||
}
|
||||
|
||||
if(!empty($dtEnd) && $dtEnd != '2020-12-31 23:59') {
|
||||
$exEnd = explode(" ",$dtEnd);
|
||||
$date_end = $exEnd[0];
|
||||
$time_end = $exEnd[1];
|
||||
} else {
|
||||
$date_end = '';
|
||||
$time_end = '';
|
||||
}
|
||||
|
||||
// setup calendar dropdowns
|
||||
$time_format = $timedate->get_user_time_format();
|
||||
$time_meridiem_start = $timedate->AMPMMenu('time_start_', $time_start, '');
|
||||
$time_meridiem_end = $timedate->AMPMMenu('time_end_', $time_end, '');
|
||||
$time_meridiem_from = $timedate->AMPMMenu('time_from_', $focus->time_from, '');
|
||||
$time_meridiem_to = $timedate->AMPMMenu('time_to_', $focus->time_to, '');
|
||||
$time_start_hour = intval(substr($time_start, 0, 2));
|
||||
$time_start_minutes = substr($time_start, 3, 5);
|
||||
$time_end_hour = intval(substr($time_end, 0, 2));
|
||||
$time_end_minutes = substr($time_end, 3, 5);
|
||||
$time_from_hour = intval(substr($focus->time_from, 0, 2));
|
||||
$time_from_min = substr($focus->time_from, 3, 5);
|
||||
$time_to_hour = intval(substr($focus->time_to, 0, 2));
|
||||
$time_to_min = substr($focus->time_to, 3, 5);
|
||||
$hours_arr = array ();
|
||||
$mins_arr = array();
|
||||
$num_of_hours = 13;
|
||||
$start_at = 1;
|
||||
|
||||
// setup function drop down
|
||||
include_once('modules/Schedulers/_AddJobsHere.php');
|
||||
|
||||
if(is_array($job_strings) && !empty($job_strings)) {
|
||||
$job_function = "<option value=''>--</option>";
|
||||
foreach($job_strings as $k => $function) {
|
||||
$job_function .= "<option value='function::".$function."'";
|
||||
if($focus->job == "function::".$function) {
|
||||
$job_function .= " SELECTED ";
|
||||
}
|
||||
$job_function .= ">".$function."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
if (empty ($time_meridiem_start)) {
|
||||
$num_of_hours = 24;
|
||||
$start_at = 0;
|
||||
}
|
||||
|
||||
for ($i = $start_at; $i < $num_of_hours; $i ++) {
|
||||
$i = $i."";
|
||||
if (strlen($i) == 1) {
|
||||
$i = "0".$i;
|
||||
}
|
||||
$hours_arr[$i] = $i;
|
||||
}
|
||||
|
||||
for($j=0; $j<60; $j++) {
|
||||
$mins_arr[$j] = str_pad($j, 2, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
// make two more array with "nulls"
|
||||
$hours_arr_unreq = $hours_arr;
|
||||
$mins_arr_unreq = $mins_arr;
|
||||
$hours_arr_unreq[''] = '--';
|
||||
$mins_arr_unreq[''] = '--';
|
||||
|
||||
// explode crontab notation
|
||||
if(!empty($focus->job_interval)) {
|
||||
$exInterval = explode("::", $focus->job_interval);
|
||||
} else {
|
||||
$exInterval = array('*','*','*','*','*');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TEMPLATE ASSIGNMENTS
|
||||
$xtpl = new XTemplate('modules/Schedulers/EditView.html');
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// PARSING FOR BASIC SETUP
|
||||
// Days of the week
|
||||
$xtpl->assign('USE_ADV_BOOL', 'false');
|
||||
$xtDays = array(0 => 'MON',
|
||||
1 => 'TUE',
|
||||
2 => 'WED',
|
||||
3 => 'THU',
|
||||
4 => 'FRI',
|
||||
5 => 'SAT',
|
||||
6 => 'SUN');
|
||||
|
||||
if($exInterval[4] == '*') {
|
||||
$xtpl->assign('ALL', "CHECKED");
|
||||
$xtpl->assign('MON', "CHECKED");
|
||||
$xtpl->assign('TUE', "CHECKED");
|
||||
$xtpl->assign('WED', "CHECKED");
|
||||
$xtpl->assign('THU', "CHECKED");
|
||||
$xtpl->assign('FRI', "CHECKED");
|
||||
$xtpl->assign('SAT', "CHECKED");
|
||||
$xtpl->assign('SUN', "CHECKED");
|
||||
} elseif(strpos($exInterval[4], ',')) {
|
||||
$daysRun = array();
|
||||
$exDays = explode(',', trim($exInterval[4]));
|
||||
foreach($exDays as $k => $days) {
|
||||
if(strpos($days, '-')) {
|
||||
$exDaysRange = explode('-', $days);
|
||||
for($i=$exDaysRange[0]; $i<=$exDaysRange[1]; $i++) {
|
||||
$xtpl->assign($xtDays[$days], "CHECKED");
|
||||
}
|
||||
} else {
|
||||
$xtpl->assign($xtDays[$days], "CHECKED");
|
||||
}
|
||||
}
|
||||
} elseif(strpos($exInterval[4], '-')) {
|
||||
$exDaysRange = explode('-', $exInterval[4]);
|
||||
for($i=$exDaysRange[0]; $i<=$exDaysRange[1]; $i++) {
|
||||
$xtpl->assign($xtDays[$i], "CHECKED");
|
||||
}
|
||||
} else {
|
||||
$xtpl->assign($xtDays[$exInterval[4]], "CHECKED");
|
||||
}
|
||||
|
||||
// Hours
|
||||
for($i=1; $i<=30; $i++) {
|
||||
$ints[$i] = $i;
|
||||
}
|
||||
$use_adv = false;
|
||||
if($exInterval[0] == '*' && $exInterval[1] == '*') {
|
||||
$xtpl->assign('BASIC_INTERVAL', get_select_options_with_id($ints, '1'));
|
||||
$xtpl->assign('BASIC_PERIOD', get_select_options_with_id($app_list_strings['scheduler_period_dom'], 'min'));
|
||||
// hours
|
||||
} elseif(strpos($exInterval[1], '*/') !== false && $exInterval[0] == '0') {
|
||||
// we have a "BASIC" type of hour setting
|
||||
$exHours = explode('/', $exInterval[1]);
|
||||
$xtpl->assign('BASIC_INTERVAL', get_select_options_with_id($ints, $exHours[1]));
|
||||
$xtpl->assign('BASIC_PERIOD', get_select_options_with_id($app_list_strings['scheduler_period_dom'], 'hour'));
|
||||
// Minutes
|
||||
} elseif(strpos($exInterval[0], '*/') !== false && $exInterval[1] == '*' ) {
|
||||
// we have a "BASIC" type of min setting
|
||||
$exMins = explode('/', $exInterval[0]);
|
||||
$xtpl->assign('BASIC_INTERVAL', get_select_options_with_id($ints, $exMins[1]));
|
||||
$xtpl->assign('BASIC_PERIOD', get_select_options_with_id($app_list_strings['scheduler_period_dom'], 'min'));
|
||||
// we've got an advanced time setting
|
||||
} else {
|
||||
$xtpl->assign('BASIC_PERIOD', get_select_options_with_id($app_list_strings['scheduler_period_dom'], 'hour'));
|
||||
$xtpl->assign('BASIC_INTERVAL', get_select_options_with_id($ints, 10));
|
||||
$xtpl->assign('ONLY_ADV', 'DISABLED');
|
||||
$xtpl->assign('USE_ADV_BOOL', 'true');
|
||||
$use_adv = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// END PARSING FOR BASIC
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
// calendar assignments
|
||||
$xtpl->assign('DATE_START', $date_start);
|
||||
$xtpl->assign('TIME_START', $time_start);
|
||||
$xtpl->assign('DATE_END', $date_end);
|
||||
$xtpl->assign('TIME_END', $time_end);
|
||||
$xtpl->assign('TIME_START_HOUR_OPTIONS', get_select_options_with_id($hours_arr, $time_start_hour));
|
||||
$xtpl->assign('TIME_START_MINUTE_OPTIONS', get_select_options_with_id($mins_arr, $time_start_minutes));
|
||||
$xtpl->assign('TIME_END_HOUR_OPTIONS', get_select_options_with_id($hours_arr_unreq, $time_end_hour));
|
||||
$xtpl->assign('TIME_END_MINUTE_OPTIONS', get_select_options_with_id($mins_arr_unreq, $time_end_minutes));
|
||||
$xtpl->assign('TIME_TO_HOUR_OPTIONS', get_select_options_with_id($hours_arr_unreq, $time_to_hour));
|
||||
$xtpl->assign('TIME_TO_MIN_OPTIONS', get_select_options_with_id($mins_arr_unreq, $time_to_min));
|
||||
$xtpl->assign('TIME_FROM_HOUR_OPTIONS', get_select_options_with_id($hours_arr_unreq, $time_from_hour));
|
||||
$xtpl->assign('TIME_FROM_MIN_OPTIONS', get_select_options_with_id($mins_arr_unreq, $time_from_min));
|
||||
$xtpl->assign('TIME_MERIDIEM_START', $time_meridiem_start);
|
||||
$xtpl->assign('TIME_MERIDIEM_END', $time_meridiem_end);
|
||||
$xtpl->assign('TIME_MERIDIEM_FROM', $time_meridiem_from);
|
||||
$xtpl->assign('TIME_MERIDIEM_TO', $time_meridiem_to);
|
||||
if (preg_match('/\d([^\d])\d/', $time_format, $match)) {
|
||||
$xtpl->assign('TIME_SEPARATOR', $match[1]);
|
||||
} else {
|
||||
$xtpl->assign('TIME_SEPARATOR', ':');
|
||||
}
|
||||
$xtpl->assign('TIME_FORMAT', '('.$time_format.')');
|
||||
$xtpl->assign('USER_DATEFORMAT', '('.$timedate->get_user_date_format().')');
|
||||
$xtpl->assign('CALENDAR_DATEFORMAT', $timedate->get_cal_date_format());
|
||||
// standard assigns
|
||||
$xtpl->assign('MOD', $mod_strings);
|
||||
$xtpl->assign('APP', $app_strings);
|
||||
$xtpl->assign('THEME', SugarThemeRegistry::current()->__toString());
|
||||
$xtpl->assign('GRIDLINE', $gridline);
|
||||
if($use_adv) {
|
||||
$javascript->script .= 'toggleAdv();';
|
||||
$xtpl->assign('JAVASCRIPT', get_set_focus_js().$javascript->getScript());
|
||||
} else {
|
||||
$xtpl->assign('JAVASCRIPT', get_set_focus_js().$javascript->getScript());
|
||||
}
|
||||
$xtpl->assign('RETURN_MODULE', 'Schedulers');
|
||||
$xtpl->assign('RETURN_ID', $focus->id);
|
||||
$xtpl->assign('RETURN_ACTION', 'DetailView');
|
||||
// module specific
|
||||
$xtpl->assign('ID', $focus->id);
|
||||
$xtpl->assign('NAME', $focus->name);
|
||||
if($focus->catch_up == 1) {
|
||||
$xtpl->assign('CATCH_UP_CHECKED', 'CHECKED');
|
||||
}
|
||||
// job
|
||||
if(strstr($focus->job, 'url::')) {
|
||||
$job_url = str_replace('url::','', $focus->job);
|
||||
} else {
|
||||
$job_url = 'http://';
|
||||
}
|
||||
|
||||
$xtpl->assign('JOB_FUNCTION', $job_function);
|
||||
$xtpl->assign('JOB_URL', $job_url);
|
||||
$xtpl->assign('JOB_INTERVAL', $focus->job_interval);
|
||||
|
||||
|
||||
$xtpl->assign('TIME_FROM', $focus->time_from);
|
||||
$xtpl->assign('TIME_TO', $focus->time_to);
|
||||
$xtpl->assign('STATUS_OPTIONS', get_select_options_with_id($app_list_strings['scheduler_status_dom'], $focus->status));
|
||||
$xtpl->assign('MINS', $exInterval[0]);
|
||||
$xtpl->assign('HOURS', $exInterval[1]);
|
||||
$xtpl->assign('DAY_OF_MONTH', $exInterval[2]);
|
||||
$xtpl->assign('MONTHS', $exInterval[3]);
|
||||
$xtpl->assign('DAY_OF_WEEK', $exInterval[4]);
|
||||
$xtpl->assign('ROLLOVER', $email->rolloverStyle);
|
||||
|
||||
$xtpl->parse("main");
|
||||
$xtpl->out("main");
|
||||
|
||||
//$focus->displayCronInstructions();
|
||||
?>
|
||||
291
modules/Schedulers/EmailDaemon.php
Normal file
291
modules/Schedulers/EmailDaemon.php
Normal file
@@ -0,0 +1,291 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
define('ATTACHMENTS_DIR', 'emails/attachments');
|
||||
|
||||
class EmailDaemon
|
||||
{
|
||||
|
||||
private $imap;
|
||||
|
||||
private $db;
|
||||
|
||||
public $users;
|
||||
|
||||
private $mailbox;
|
||||
|
||||
public $emails;
|
||||
|
||||
public $id;
|
||||
|
||||
public $emailAdress;
|
||||
|
||||
public $emailType;
|
||||
|
||||
public $emailText;
|
||||
|
||||
public $savedId;
|
||||
|
||||
public $modules = array(
|
||||
'Accounts',
|
||||
'Contacts'
|
||||
);
|
||||
|
||||
public $relationToSave;
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
require_once ('emails/ImapMailbox.php');
|
||||
|
||||
$this->db = $GLOBALS['db'];
|
||||
}
|
||||
|
||||
public function getUsers ()
|
||||
{
|
||||
$usersBean = new User();
|
||||
$this->users = $usersBean->get_full_list('',
|
||||
"deleted=0 and status='Active' and google_login is not null and google_password is not null and id='2e72f487-d92b-954e-f50c-528b10ce81c9'");
|
||||
}
|
||||
|
||||
public function setConnection ($host, $login, $password, $box)
|
||||
{
|
||||
$this->mailbox = new ImapMailbox($host, $login, $password,
|
||||
ATTACHMENTS_DIR, 'utf-8');
|
||||
}
|
||||
|
||||
public function generateEmailID ($header)
|
||||
{
|
||||
return md5(
|
||||
$header[0]->udate . "" . $header[0]->date . "" . $header[0]->to .
|
||||
"" . $header[0]->subject);
|
||||
}
|
||||
|
||||
public function isExistEmail ($id)
|
||||
{
|
||||
$emailsBean = new Email();
|
||||
$email = $emailsBean->get_full_list('', "message_id='" . $id . "'");
|
||||
|
||||
if (count($email) > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// pobiera ID emaili na poczcie
|
||||
public function getEmailsId ($date)
|
||||
{
|
||||
if ($date != '' && $date != '0000-00-00 00:00:00') {
|
||||
$da = date("d M Y", strtotime($date) - 86400);
|
||||
} else {
|
||||
$da = date("d M Y", strtotime("-1 day"));
|
||||
}
|
||||
$this->emails = $this->mailbox->searchMailBox("SINCE \"$da\"");
|
||||
}
|
||||
|
||||
// pobiera całego emaila
|
||||
public function getFullEmailData ($email)
|
||||
{
|
||||
return $this->mailbox->getMail($email);
|
||||
}
|
||||
|
||||
// tylko nagłowek emaila
|
||||
public function getEmailHeader ($email)
|
||||
{
|
||||
return $this->mailbox->getMailInfo($email);
|
||||
}
|
||||
|
||||
// ustawia flagę jako nieprzeczytany
|
||||
public function setNotReadedFlag ($email)
|
||||
{
|
||||
$this->mailbox->markMailAsUnread($email);
|
||||
}
|
||||
|
||||
public function getUserPassword ($id)
|
||||
{
|
||||
$r = $this->db->query(
|
||||
"select CAST(AES_DECRYPT(google_password, 'jakistamhash123') as CHAR)
|
||||
AS google_password FROM users where id='" . $id . "'");
|
||||
$dane = $this->db->fetchByAssoc($r);
|
||||
return $dane['google_password'];
|
||||
}
|
||||
|
||||
public function setEmailAdress ($user)
|
||||
{
|
||||
if ($user->google_address == '') {
|
||||
$this->emailAdress = $user->google_login;
|
||||
} else {
|
||||
$this->emailAdress = $user->google_address;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNewEmails ()
|
||||
{
|
||||
$this->getUsers();
|
||||
foreach ($this->users as $user) {
|
||||
|
||||
if ($user->mail_server == '') {
|
||||
$server = '{imap.gmail.com:993/imap/ssl}[Gmail]/Wszystkie';
|
||||
} else {
|
||||
$server = $user->mail_server;
|
||||
}
|
||||
|
||||
$this->setEmailAdress($user);
|
||||
|
||||
$this->setConnection($server, $user->google_login,
|
||||
$this->getUserPassword($user->id));
|
||||
if ($this->mailbox->connected != false) {
|
||||
$this->getEmailsId($user->google_last_login);
|
||||
$this->checkEmails();
|
||||
} else {
|
||||
echo 'coś złego';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkEmails ()
|
||||
{
|
||||
foreach ($this->emails as $email) {
|
||||
|
||||
$header = $this->getEmailHeader($email);
|
||||
|
||||
$this->id = $this->generateEmailID($header);
|
||||
|
||||
if ($this->isExistEmail($this->id) != true) {
|
||||
$this->SaveFreshEmail($email);
|
||||
$this->setNotReadedFlag($email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveEmail ($email)
|
||||
{
|
||||
$e = new Email();
|
||||
$e->message_id = $this->id;
|
||||
$e->type = $this->emailType;
|
||||
$e->status = 'archived';
|
||||
$e->date_send=$email->date;
|
||||
$e->intent = 'read';
|
||||
$e->flagged = 0;
|
||||
$e->reply_to_status = 0;
|
||||
$e->name = $email->subject;
|
||||
$e->description = $email->textPlain;
|
||||
$e->description_html = $email->textHtml;
|
||||
$e->from_addr_name = $email->fromAddress;
|
||||
$to = '';
|
||||
foreach ($email->to as $key => $val) {
|
||||
$to .= $key;
|
||||
}
|
||||
$e->to_addrs_names = $to;
|
||||
$this->savedId = $e->save();
|
||||
|
||||
}
|
||||
|
||||
public function searchRelations ($email)
|
||||
{
|
||||
$this->relationToSave=array();
|
||||
foreach ($this->modules as $module) {
|
||||
$ss = new SugarEmailAddress();
|
||||
if ($this->emailType == 'out') {
|
||||
foreach ($email->to as $key => $val) {
|
||||
$this->relationToSave[$module]= $ss->getRelatedId($key, $module);
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->relationToSave[$module]= $ss->getRelatedId($email->fromAddress, $module);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function relationSqlSave($parent_id,$module){
|
||||
$query=" INSERT into email_id_rel VALUES(
|
||||
'".create_guid()."',
|
||||
'".$this->savedId."',
|
||||
'".$parent_id."',
|
||||
'".$module."',
|
||||
'0'
|
||||
)";
|
||||
|
||||
$this->db->query($query);
|
||||
}
|
||||
|
||||
public function saveRelations ()
|
||||
{
|
||||
|
||||
foreach ($this->relationToSave as $module=>$key){
|
||||
foreach ($key as $relation_id=>$val2){
|
||||
|
||||
if($module=='Contacts'){
|
||||
if($val2!=false){
|
||||
$this->relationSqlSave($val2,$module);
|
||||
}
|
||||
$a = new Contact();
|
||||
$a->retrieve($val2);
|
||||
if($a->account_id!=''){
|
||||
$this->relationSqlSave($a->account_id,'Accounts');
|
||||
}
|
||||
} else {
|
||||
if($val2!=false){
|
||||
$this->relationSqlSave($val2,$module);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function SaveFreshEmail ($email)
|
||||
{
|
||||
$email = $this->getFullEmailData($email);
|
||||
|
||||
$this->setEmailType($email);
|
||||
$this->searchRelations($email);
|
||||
$this->saveEmail($email);
|
||||
$this->saveRelations();
|
||||
$this->saveAttachments($email);
|
||||
}
|
||||
|
||||
public function setEmailType ($email)
|
||||
{
|
||||
if ($email->fromAddress == $this->emailAdress) {
|
||||
// wychodzący
|
||||
$this->emailType = 'out';
|
||||
} else {
|
||||
// przychodzący
|
||||
$this->emailType = 'inbound';
|
||||
}
|
||||
}
|
||||
|
||||
public function setEmailText ($email)
|
||||
{
|
||||
$this->emailText = $email->textHtml;
|
||||
}
|
||||
|
||||
public function saveAttachments($email){
|
||||
foreach ($email->attachments as &$value) {
|
||||
|
||||
$note=$this->saveAttachment($value);
|
||||
substr($value->filePath,strlen(ATTACHMENTS_DIR.'/')).'<br>';
|
||||
rename($value->filePath, '/var/www/html/crm/upload/'.$note);
|
||||
// unlink($value->filePath);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function saveAttachment($value){
|
||||
$n = new Note();
|
||||
|
||||
$n->name=$value->name;
|
||||
$n->filename=$value->name;
|
||||
$n->parent_type='Emails';
|
||||
$n->parent_id=$this->savedId;
|
||||
return $n->save();
|
||||
}
|
||||
}
|
||||
|
||||
echo "<pre>";
|
||||
$ed = new EmailDaemon();
|
||||
$ed->getNewEmails();
|
||||
// $ed->getEmailsId();
|
||||
|
||||
?>
|
||||
75
modules/Schedulers/JobThread.php
Executable file
75
modules/Schedulers/JobThread.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
/*if($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) { // make sure this script only gets executed locally
|
||||
header('Location: index.php?action=Login&module=Users');
|
||||
return;
|
||||
} else
|
||||
*/
|
||||
if(!empty($_REQUEST['job_id'])) {
|
||||
|
||||
|
||||
$job_id = $_REQUEST['job_id'];
|
||||
|
||||
if(empty($GLOBALS['log'])) { // setup logging
|
||||
|
||||
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
|
||||
}
|
||||
ob_implicit_flush();
|
||||
ignore_user_abort(true);// keep processing if browser is closed
|
||||
set_time_limit(0);// no time out
|
||||
$GLOBALS['log']->debug('Job [ '.$job_id.' ] is about to FIRE. Updating Job status in DB');
|
||||
$qLastRun = "UPDATE schedulers SET last_run = '".$runTime."' WHERE id = '".$job_id."'";
|
||||
$this->db->query($qStatusUpdate);
|
||||
$this->db->query($qLastRun);
|
||||
|
||||
$job = new Job();
|
||||
$job->runtime = gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now'));
|
||||
if($job->startJob($job_id)) {
|
||||
$GLOBALS['log']->info('----->Job [ '.$job_id.' ] was fired successfully');
|
||||
} else {
|
||||
$GLOBALS['log']->fatal('----->Job FAILURE job [ '.$job_id.' ] could not complete successfully.');
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug('Job [ '.$a['job'].' ] has been fired - dropped from schedulers_times queue and last_run updated');
|
||||
$this->finishJob($job_id);
|
||||
return true;
|
||||
} else {
|
||||
$GLOBALS['log']->fatal('JOB FAILURE JobThread.php called with no job_id. Suiciding this thread.');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
80
modules/Schedulers/ListView.html
Executable file
80
modules/Schedulers/ListView.html
Executable file
@@ -0,0 +1,80 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description:
|
||||
* Created On: Sep 28, 2005
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): Chris Nojima
|
||||
********************************************************************************/
|
||||
-->
|
||||
|
||||
<!-- BEGIN: main -->
|
||||
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
|
||||
<!-- BEGIN: list_nav_row -->
|
||||
{PAGINATION}
|
||||
<!-- END: list_nav_row -->
|
||||
<tr height="20">
|
||||
<td scope="col" NOWRAP>{CHECKALL}</td>
|
||||
<td scope="col" width="35%" ><slot><a href="{ORDER_BY}name" class="listViewThLinkS1">
|
||||
{MOD.LBL_LIST_NAME}{arrow_start}{name_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="20%" ><slot><a href="{ORDER_BY}job_interval" class="listViewThLinkS1">
|
||||
{MOD.LBL_LIST_JOB_INTERVAL}{arrow_start}{job_interval_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="25%" ><slot><a href="{ORDER_BY}date_time_start" class="listViewThLinkS1">
|
||||
{MOD.LBL_LIST_RANGE}{arrow_start}{status_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="15%" ><slot><a href="{ORDER_BY}status" class="listViewThLinkS1">
|
||||
{MOD.LBL_LIST_STATUS}{arrow_start}{list_order_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="5%" > </td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN: row -->
|
||||
<tr height="20" class="{ROW_COLOR}S1">
|
||||
<td>{PREROW}</td>
|
||||
<td scope='row' valign=TOP>
|
||||
<slot><a href="{URL_PREFIX}index.php?action=DetailView&module=Schedulers&record={SCHEDULER.ID}" >{SCHEDULER.NAME}</a></slot></td>
|
||||
<td valign=TOP>
|
||||
<slot>{SCHEDULER.JOB_INTERVAL}</slot></td>
|
||||
<td valign=TOP>
|
||||
<slot>{SCHEDULER.DATE_TIME_START} - {SCHEDULER.DATE_TIME_END}</slot></td>
|
||||
<td valign=TOP>
|
||||
<slot>{SCHEDULER.STATUS}</slot></td>
|
||||
<td nowrap="nowrap" valign="top">
|
||||
<slot><a class="listViewTdToolsS1" onclick="return confirm('{MOD.NTC_DELETE_CONFIRMATION}')" href="{URL_PREFIX}index.php?action=Delete&module=Schedulers&record={SCHEDULER.ID}&return_module=Schedulers&return_action=index&return_id=" >{REMOVE_INLINE_PNG}</a> <a class="listViewTdToolsS1" onclick="return confirm('{MOD.NTC_DELETE_CONFIRMATION}')" href="{URL_PREFIX}index.php?action=Delete&module=Schedulers&record={SCHEDULER.ID}&return_module=Schedulers&return_action=index&return_id=">{APP.LNK_DELETE}</a></slot></td>
|
||||
</tr>
|
||||
<!-- END: row -->
|
||||
{PAGINATION}
|
||||
</table>
|
||||
<!-- END: main -->
|
||||
73
modules/Schedulers/ListView.php
Executable file
73
modules/Schedulers/ListView.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$header_text = '';
|
||||
global $mod_strings;
|
||||
global $app_list_strings;
|
||||
global $app_strings;
|
||||
global $current_user;
|
||||
global $current_language;
|
||||
$current_module_strings = return_module_language($current_language, 'Schedulers');
|
||||
|
||||
$focus = new Scheduler();
|
||||
$focus->checkCurl();
|
||||
|
||||
$where = '';
|
||||
$limit = '0';
|
||||
$varName = $focus->object_name; //'Scheduler'
|
||||
if(!empty($_REQUEST['Schedulers_SCHEDULER_ORDER_BY'])) {
|
||||
$orderBy = $_REQUEST['Schedulers_SCHEDULER_ORDER_BY'];
|
||||
} else {
|
||||
$orderBy = $focus->order_by;
|
||||
}
|
||||
$allowByOverride = true;
|
||||
|
||||
$listView = new ListView();
|
||||
$listView->show_mass_update = false; // don't want to mass delete all Schedules
|
||||
$listView->force_mass_update = true; // show checkboxes
|
||||
$listView->show_mass_update_form = false; // don't want the mass update
|
||||
$listView->initNewXTemplate('modules/Schedulers/ListView.html', $current_module_strings);
|
||||
$listView->setHeaderTitle($current_module_strings['LBL_LIST_TITLE']);
|
||||
$listView->setQuery($where, $limit, $orderBy, $varName, $allowByOverride);
|
||||
$listView->xTemplateAssign("REMOVE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" alt="'.$app_strings['LNK_REMOVE'].'" border="0"'));
|
||||
$listView->processListView($focus, "main", "SCHEDULER");
|
||||
|
||||
$focus->displayCronInstructions();
|
||||
?>
|
||||
352
modules/Schedulers/MailingCron.php
Normal file
352
modules/Schedulers/MailingCron.php
Normal file
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
class MailingCron {
|
||||
private $db;
|
||||
public $groups;
|
||||
public $contacts;
|
||||
public $accounts;
|
||||
public $template;
|
||||
public $primary;
|
||||
public $eMM;
|
||||
public $replaceStrings;
|
||||
public function replaceStringsDefine() {
|
||||
$this->replaceStrings = array ();
|
||||
$this->replaceStrings ['Account'] ['$account_name'] = 'name';
|
||||
$this->replaceStrings ['Account'] ['$account_description'] = 'description';
|
||||
$this->replaceStrings ['Account'] ['$account_billing_address_street'] = 'billing_address_street';
|
||||
$this->replaceStrings ['Account'] ['$account_billing_address_city'] = 'billing_address_city';
|
||||
$this->replaceStrings ['Account'] ['$account_billing_address_state'] = 'billing_address_state';
|
||||
$this->replaceStrings ['Account'] ['$account_billing_address_postalcode'] = 'billing_address_postalcode';
|
||||
$this->replaceStrings ['Account'] ['$account_billing_address_country'] = 'billing_address_country';
|
||||
|
||||
$this->replaceStrings ['Account'] ['$account_shipping_address_street'] = 'shipping_address_street';
|
||||
$this->replaceStrings ['Account'] ['$account_shipping_address_city'] = 'shipping_address_city';
|
||||
$this->replaceStrings ['Account'] ['$account_shipping_address_state'] = 'shipping_address_state';
|
||||
$this->replaceStrings ['Account'] ['$account_shipping_address_postalcode'] = 'shipping_address_postalcode';
|
||||
$this->replaceStrings ['Account'] ['$account_shipping_address_country'] = 'shipping_address_country';
|
||||
|
||||
$this->replaceStrings ['Account'] ['$account_krs'] = 'krs';
|
||||
$this->replaceStrings ['Account'] ['$account_regon'] = 'regon';
|
||||
$this->replaceStrings ['Account'] ['$account_to_vatid'] = 'to_vatid';
|
||||
|
||||
$this->replaceStrings ['Contact'] ['$contact_salutation'] = 'salutation';
|
||||
$this->replaceStrings ['Contact'] ['$contact_first_name'] = 'first_name';
|
||||
$this->replaceStrings ['Contact'] ['$contact_last_name'] = 'last_name';
|
||||
$this->replaceStrings ['Contact'] ['$contact_full_name'] = 'full_name';
|
||||
|
||||
$this->replaceStrings ['Contact'] ['$contact_primary_address_street'] = 'primary_address_street';
|
||||
$this->replaceStrings ['Contact'] ['$contact_primary_address_city'] = 'primary_address_city';
|
||||
$this->replaceStrings ['Contact'] ['$contact_primary_address_state'] = 'primary_address_state';
|
||||
$this->replaceStrings ['Contact'] ['$contact_primary_address_postalcode'] = 'primary_address_postalcode';
|
||||
$this->replaceStrings ['Contact'] ['$contact_primary_address_country'] = 'primary_address_country';
|
||||
|
||||
$this->replaceStrings ['Contact'] ['$contact_second_address_street'] = 'alt_address_street';
|
||||
$this->replaceStrings ['Contact'] ['$contact_second_address_city'] = 'alt_address_city';
|
||||
$this->replaceStrings ['Contact'] ['$contact_second_address_state'] = 'alt_address_state';
|
||||
$this->replaceStrings ['Contact'] ['$contact_second_address_postalcode'] = 'alt_address_postalcode';
|
||||
$this->replaceStrings ['Contact'] ['$contact_second_address_country'] = 'alt_address_country';
|
||||
}
|
||||
public function replaceText($type, $account) {
|
||||
$was=false;
|
||||
// Account or Leads
|
||||
if ($type == 'Account') {
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_name', $account->{$this->replaceStrings [$type] ['$account_name']}, $this->template->body_html);
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_description', $account->{$this->replaceStrings [$type] ['$account_description']},$this->template->{$account->id.'body'} );
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_billing_address_street', $account->{$this->replaceStrings [$type] ['$account_billing_address_street']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_billing_address_city', $account->{$this->replaceStrings [$type] ['$account_billing_address_city']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_billing_address_state', $account->{$this->replaceStrings [$type] ['$account_billing_address_state']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_billing_address_postalcode', $account->{$this->replaceStrings [$type] ['$account_billing_address_postalcode']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_billing_address_country', $account->{$this->replaceStrings [$type] ['$account_billing_address_country']},$this->template->{$account->id.'body'} );
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_shipping_address_street', $account->{$this->replaceStrings [$type] ['$account_shipping_address_street']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_shipping_address_city', $account->{$this->replaceStrings [$type] ['$account_shipping_address_city']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_shipping_address_state', $account->{$this->replaceStrings [$type] ['$account_shipping_address_state']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_shipping_address_postalcode', $account->{$this->replaceStrings [$type] ['$account_shipping_address_postalcode']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_shipping_address_country', $account->{$this->replaceStrings [$type] ['$account_shipping_address_country']},$this->template->{$account->id.'body'} );
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_krs', $account->{$this->replaceStrings [$type] ['$account_krs']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_regon', $account->{$this->replaceStrings [$type] ['$account_regon']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$account_to_vatid', $account->{$this->replaceStrings [$type] ['$account_to_vatid']},$this->template->{$account->id.'body'} );
|
||||
$was=true;
|
||||
}
|
||||
// Contact and Contact Leads
|
||||
$salution = array (
|
||||
'' => '',
|
||||
'Mr.' => 'Sz. Pan',
|
||||
'Ms.' => 'Sz. Pani',
|
||||
'Mrs.' => 'Sz. Pani',
|
||||
'Dr.' => 'Dr.',
|
||||
'Prof.' => 'Prof.'
|
||||
);
|
||||
if ($type == 'Contact') {
|
||||
if($was==true){
|
||||
$this->template->body_html=$this->template->{$account->id.'body'};
|
||||
}
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_salutation', $salution [$account->{$this->replaceStrings [$type] ['$contact_salutation']}],$this->template->body_html);
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_first_name', $account->{$this->replaceStrings [$type] ['$contact_first_name']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_last_name', $account->{$this->replaceStrings [$type] ['$contact_last_name']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_full_name', $account->{$this->replaceStrings [$type] ['$contact_first_name']} . ' ' . $account->{$this->replaceStrings [$type] ['$contact_last_name']},$this->template->{$account->id.'body'} );
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_primary_address_street', $account->{$this->replaceStrings [$type] ['$contact_primary_address_street']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_primary_address_city', $account->{$this->replaceStrings [$type] ['$contact_primary_address_city']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_primary_address_state', $account->{$this->replaceStrings [$type] ['$contact_primary_address_state']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_primary_address_postalcode', $account->{$this->replaceStrings [$type] ['$contact_primary_address_postalcode']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_primary_address_country', $account->{$this->replaceStrings [$type] ['$contact_primary_address_country']},$this->template->{$account->id.'body'} );
|
||||
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_second_address_street', $account->{$this->replaceStrings [$type] ['$contact_second_address_street']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_second_address_city', $account->{$this->replaceStrings [$type] ['$contact_second_address_city']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_second_address_state', $account->{$this->replaceStrings [$type] ['$contact_second_address_state']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_second_address_postalcode', $account->{$this->replaceStrings [$type] ['$contact_second_address_postalcode']},$this->template->{$account->id.'body'} );
|
||||
$this->template->{$account->id.'body'} = str_replace ( '$contact_second_address_country', $account->{$this->replaceStrings [$type] ['$contact_second_address_country']},$this->template->{$account->id.'body'} );
|
||||
}
|
||||
|
||||
// return $this->template->body_html;
|
||||
}
|
||||
public function __construct() {
|
||||
$this->db = $GLOBALS ['db'];
|
||||
$this->replaceStringsDefine ();
|
||||
}
|
||||
public function reparseContacts() {
|
||||
$con = array ();
|
||||
foreach ( $this->contacts as $group ) {
|
||||
$con [] = $group ['cat_id'];
|
||||
}
|
||||
|
||||
$this->contacts = $con;
|
||||
}
|
||||
public function getMalingToSend() {
|
||||
|
||||
$z = $this->db->query ( "select * from ecmmailingmessages where deleted=0 and send!=1 and parent_id is not null and date_end<='" . date ( "Y-m-d H:i:s", time () - 7200 ) . "'" );
|
||||
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
|
||||
$eMM = new EcmMailingMessage ();
|
||||
|
||||
$eMM->retrieve ( $dane ['id'] );
|
||||
$this->eMM=$eMM;
|
||||
$this->template = new EmailTemplate ();
|
||||
$this->template->retrieve ( $dane ['parent_id'] );
|
||||
$this->primary = $this->template->body_html;
|
||||
$this->accounts = array ();
|
||||
|
||||
$this->groups = $eMM->getPositionList55 ( true );
|
||||
$this->contacts = $eMM->getPositionList56 ( true );
|
||||
$this->reparseContacts ();
|
||||
|
||||
if (count ( $this->groups ) > 0 && count ( $this->contacts ) > 0) {
|
||||
$this->getAddressesToSend ();
|
||||
$this->searchContactsForAccount ();
|
||||
$this->searchContactsForLeads ();
|
||||
} else {
|
||||
if (count ( $this->groups ) == 0 && count ( $this->contacts ) > 0) {
|
||||
|
||||
$this->sendMailingForContactLeadNoLead ();
|
||||
$this->sendMailingForContactNoAccounts ();
|
||||
}
|
||||
}
|
||||
|
||||
// $this->sendMailingForContact();
|
||||
|
||||
$this->db->query("update ecmmailingmessages set send=1 where id='".$dane['id']."'");
|
||||
}
|
||||
}
|
||||
public function getAddressesToSend() {
|
||||
foreach ( $this->groups as $group ) {
|
||||
|
||||
$z = $this->db->query ( "SELECT * FROM ecmaccountcategories_bean WHERE ecmaccountcategory_id='" . $group ['cat_id'] . "' and deleted='0'" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
$this->accounts [$dane ['bean_name']] [] = $dane ['bean_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
public function searchContactsForLeads() {
|
||||
foreach ( $this->accounts ['Leads'] as $id ) {
|
||||
|
||||
$this->template->body_html = $this->primary;
|
||||
$account = new Lead ();
|
||||
$account->retrieve ( $id );
|
||||
//$this->replaceText ( 'Account', $account );
|
||||
$idd=$account->id;
|
||||
$z = $this->db->query ( "SELECT * FROM leads_contactleads where lead_id='" . $idd. "' and deleted=0" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
$account->id=$dane ['contactlead_id'];
|
||||
$this->replaceText ( 'Account', $account );
|
||||
$this->sendMailingForContactLead ( $dane ['contactlead_id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
public function sendMailingForContactLead($id) {
|
||||
$cats = array ();
|
||||
$z = $this->db->query ( "SELECT ecmmailingcategoriy_id FROM ecmmailingcategories_relation where parent_id='" . $id . "' and available=1" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
$cats = $dane ['ecmmailingcategoriy_id'];
|
||||
}
|
||||
|
||||
if (in_array ( $cats, $this->contacts )) {
|
||||
$account = new ContactLead ();
|
||||
$account->retrieve ( $id );
|
||||
if ($account->id != "") {
|
||||
$sea = new SugarEmailAddress ();
|
||||
// Grab the array of addresses
|
||||
|
||||
$addresses = $sea->getAddressesByGUID ( $id, "ContactLeads" );
|
||||
foreach ( $addresses as $address ) {
|
||||
if ($address ['email_address'] != "") {
|
||||
$this->replaceText ( 'Contact', $account );
|
||||
|
||||
$this->sendEmail ( 'Contact', $account, $address ['email_address'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function searchContactsForAccount() {
|
||||
foreach ( $this->accounts ['Accounts'] as $id ) {
|
||||
|
||||
$this->template->body_html = $this->primary;
|
||||
$account = new Account ();
|
||||
$account->retrieve ( $id );
|
||||
//$this->replaceText ( 'Account', $account );
|
||||
$idd=$account->id;
|
||||
$z = $this->db->query ( "SELECT * FROM accounts_contacts where account_id='" . $idd. "' and deleted=0" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
$account->id=$dane ['contactlead_id'];
|
||||
$this->replaceText ( 'Account', $account );
|
||||
$this->sendMailingForContact ( $dane ['contact_id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
public function sendMailingForContactLeadNoLead() {
|
||||
$cats = array ();
|
||||
$z = $this->db->query ( "SELECT ecmmailingcategoriy_id,parent_id FROM ecmmailingcategories_relation where available=1 and parent_type='Contact' and deleted=0" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
if (in_array ( $dane ['ecmmailingcategoriy_id'], $this->contacts )) {
|
||||
$account = new ContactLead ();
|
||||
$account->retrieve ( $dane ['parent_id']);
|
||||
if ($account->id != "") {
|
||||
$sea = new SugarEmailAddress ();
|
||||
// Grab the array of addresses
|
||||
|
||||
$addresses = $sea->getAddressesByGUID ( $dane ['parent_id'], "ContactLeads" );
|
||||
foreach ( $addresses as $address ) {
|
||||
if ($address ['email_address'] != "") {
|
||||
$this->replaceText ( 'Contact', $account );
|
||||
|
||||
$this->sendEmail ( 'Contact', $account, $address ['email_address'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function sendMailingForContactNoAccounts() {
|
||||
$cats = array ();
|
||||
$z = $this->db->query ( "SELECT ecmmailingcategoriy_id,parent_id FROM ecmmailingcategories_relation where available=1 and parent_type='Contact' and deleted=0" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
|
||||
if (in_array ( $dane ['ecmmailingcategoriy_id'], $this->contacts )) {
|
||||
|
||||
$account = new Contact ();
|
||||
$account->retrieve ( $dane ['parent_id'] );
|
||||
if ($account->id != "") {
|
||||
|
||||
$sea = new SugarEmailAddress ();
|
||||
// Grab the array of addresses
|
||||
|
||||
$addresses = $sea->getAddressesByGUID ( $dane ['parent_id'], "Contacts" );
|
||||
foreach ( $addresses as $address ) {
|
||||
if ($address ['email_address'] != "") {
|
||||
$this->replaceText ( 'Contact', $account );
|
||||
|
||||
$this->sendEmail ( 'Contact', $account, $address ['email_address'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function sendMailingForContact($id) {
|
||||
$cats = array ();
|
||||
$z = $this->db->query ( "SELECT ecmmailingcategoriy_id FROM ecmmailingcategories_relation where parent_id='" . $id . "' and available=1" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
$cats = $dane ['ecmmailingcategoriy_id'];
|
||||
}
|
||||
|
||||
if (in_array ( $cats, $this->contacts )) {
|
||||
$account = new Contact ();
|
||||
$account->retrieve ( $id );
|
||||
if ($account->id != "") {
|
||||
$sea = new SugarEmailAddress ();
|
||||
// Grab the array of addresses
|
||||
|
||||
$addresses = $sea->getAddressesByGUID ( $id, "Contacts" );
|
||||
foreach ( $addresses as $address ) {
|
||||
if ($address ['email_address'] != "") {
|
||||
$this->replaceText ( 'Contact', $account );
|
||||
|
||||
$this->sendEmail ( 'Contact', $account, $address ['email_address'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function getAttachments(&$mail) {
|
||||
$z = $this->db->query ( "select * from notes where parent_id='" . $this->template->id . "' and deleted=0" );
|
||||
while ( $dane = $this->db->fetchByAssoc ( $z ) ) {
|
||||
|
||||
$mail->addAttachment ( 'upload/' . $dane ['id'], $dane ['filename'] );
|
||||
}
|
||||
}
|
||||
public function sendEmail($type, $object, $addresses) {
|
||||
require_once 'include/phpMailer2/class.phpmailer.php';
|
||||
require_once 'include/phpMailer2/class.smtp.php';
|
||||
$mail = new PHPMailer2 ();
|
||||
|
||||
// $mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
$mail->isSMTP (); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
|
||||
$res=$this->db->query("select id,google_login,CAST(AES_DECRYPT(google_password, 'jakistamhash123') as CHAR)
|
||||
AS google_password FROM users where id='".$this->eMM->assigned_user_id."'");
|
||||
$dane2=$this->db->fetchByAssoc($res);
|
||||
|
||||
if($dane2['google_login']!="" && $dane2['google_password']!=""){
|
||||
$mail->Username = $dane2['google_login'];
|
||||
$mail->Password = $dane2['google_password'];
|
||||
|
||||
} else {
|
||||
$mail->Username = 'Marketing@e5.pl'; // SMTP username
|
||||
$mail->Password = '&r8TZbQy'; // SMTP password
|
||||
}
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail ->charSet = "UTF-8";
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 587; // TCP port to connect to
|
||||
|
||||
$mail->setFrom ( 'Marketing@e5.pl' );
|
||||
|
||||
$mail->addAddress ( $addresses );
|
||||
// $mail->addBCC('Marketing@e5.pl');
|
||||
$mail->isHTML ( true );
|
||||
|
||||
$this->getAttachments ( $mail );
|
||||
|
||||
$mail->Subject = $this->template->subject;
|
||||
|
||||
$mail->Body = html_entity_decode ( $this->template->{$object->id.'body'});
|
||||
|
||||
if (! $mail->send ()) {
|
||||
echo 'Message could not be sent.';
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
51
modules/Schedulers/Menu.php
Executable file
51
modules/Schedulers/Menu.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
global $mod_strings;
|
||||
global $current_user;
|
||||
//array("index.php?module=ProductTemplates&action=EditView&return_module=ProductTemplates&return_action=DetailView", $mod_strings['LNK_NEW_PRODUCT'],"Products"),
|
||||
if(is_admin($current_user)){
|
||||
$module_menu = array(
|
||||
array("index.php?module=Schedulers&action=index", $mod_strings['LNK_LIST_SCHEDULER'],"Schedulers"),
|
||||
array("index.php?module=Schedulers&action=EditView", $mod_strings['LNK_NEW_SCHEDULER'],"CreateScheduler"),
|
||||
|
||||
);
|
||||
}
|
||||
?>
|
||||
171
modules/Schedulers/Save.php
Executable file
171
modules/Schedulers/Save.php
Executable file
@@ -0,0 +1,171 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$focus = new Scheduler();
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
|
||||
// deal with empty values
|
||||
if(!empty($_REQUEST['date_end']) && !empty($_REQUEST['time_hour_end']) && !empty($_REQUEST['time_minute_end']) ) {
|
||||
$date_time_end = $_REQUEST['date_end']." ".str_pad($_REQUEST['time_hour_end'],2,'0',STR_PAD_LEFT).":".str_pad($_REQUEST['time_minute_end'],2,'0',STR_PAD_LEFT).$_REQUEST['time_end_meridiem'];
|
||||
} else {
|
||||
$date_time_end = '';
|
||||
}
|
||||
if( (!empty($_REQUEST['time_hour_from']) || $_REQUEST['time_hour_from'] == '0' ) && (!empty($_REQUEST['time_minute_from']) || $_REQUEST['time_minute_from'] == '0' ) ) {
|
||||
$time_from = str_pad($_REQUEST['time_hour_from'],2,'0',STR_PAD_LEFT).":".str_pad($_REQUEST['time_minute_from'],2,'0',STR_PAD_LEFT);
|
||||
if(!empty($_REQUEST['time_from_meridiem'])) {
|
||||
$time_from .= $_REQUEST['time_from_meridiem'];
|
||||
}
|
||||
} else {
|
||||
$time_from = '';
|
||||
}
|
||||
if( (!empty($_REQUEST['time_hour_to']) || $_REQUEST['time_hour_to'] == '0') && (!empty($_REQUEST['time_minute_to']) || $_REQUEST['time_minute_to'] == '0') ) {
|
||||
$time_to = str_pad($_REQUEST['time_hour_to'],2,'0',STR_PAD_LEFT).":".str_pad($_REQUEST['time_minute_to'],2,'0',STR_PAD_LEFT);
|
||||
if(!empty($_REQUEST['time_to_meridiem'])) {
|
||||
$time_to .= $_REQUEST['time_to_meridiem'];
|
||||
}
|
||||
} else {
|
||||
$time_to = '';
|
||||
}
|
||||
$date_time_start = $_REQUEST['date_start']." ".str_pad($_REQUEST['time_hour_start'],2,'0',STR_PAD_LEFT).":".str_pad($_REQUEST['time_minute_start'],2,'0',STR_PAD_LEFT);
|
||||
if(!empty($_REQUEST['time_start_meridiem'])) {
|
||||
$date_time_start .= $_REQUEST['time_start_meridiem'];
|
||||
}
|
||||
if(empty($_REQUEST['catch_up'])) {
|
||||
$focus->catch_up = 0;
|
||||
} else {
|
||||
$focus->catch_up = 1;
|
||||
}
|
||||
|
||||
$focus->date_time_start = $date_time_start;
|
||||
$focus->date_time_end = $date_time_end;
|
||||
$focus->time_from = $time_from;
|
||||
$focus->time_to = $time_to;
|
||||
$focus->status = $_REQUEST['status'];
|
||||
$focus->name = $_REQUEST['name'];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// USE_ADV override
|
||||
if($_REQUEST['use_adv'] == 'false') {
|
||||
// days of week
|
||||
$xtDays = array(0 => 'mon',
|
||||
1 => 'tue',
|
||||
2 => 'wed',
|
||||
3 => 'thu',
|
||||
4 => 'fri',
|
||||
5 => 'sat',
|
||||
6 => 'sun');
|
||||
|
||||
if( (isset($_REQUEST['mon']) && $_REQUEST['mon'] == 'true') &&
|
||||
(isset($_REQUEST['tue']) && $_REQUEST['tue'] == 'true') &&
|
||||
(isset($_REQUEST['wed']) && $_REQUEST['wed'] == 'true') &&
|
||||
(isset($_REQUEST['thu']) && $_REQUEST['thu'] == 'true') &&
|
||||
(isset($_REQUEST['fri']) && $_REQUEST['fri'] == 'true') &&
|
||||
(isset($_REQUEST['sat']) && $_REQUEST['sat'] == 'true') &&
|
||||
(isset($_REQUEST['sun']) && $_REQUEST['sun'] == 'true') ) {
|
||||
$_REQUEST['day_of_week'] = '*';
|
||||
} else {
|
||||
$day_string = '';
|
||||
foreach($xtDays as $k => $day) {
|
||||
if(isset($_REQUEST[$day]) && $_REQUEST[$day] == 'true') {
|
||||
if($day_string != '') {
|
||||
$day_string .= ',';
|
||||
}
|
||||
$day_string .= $k;
|
||||
}
|
||||
}
|
||||
$_REQUEST['day_of_week'] = $day_string;
|
||||
}
|
||||
|
||||
|
||||
if($_REQUEST['basic_period'] == 'min') {
|
||||
$_REQUEST['mins'] = '*/'.$_REQUEST['basic_interval'];
|
||||
$_REQUEST['hours'] = '*';
|
||||
} else {
|
||||
$_REQUEST['hours'] = '*/'.$_REQUEST['basic_interval'];
|
||||
$_REQUEST['mins'] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//// END USE_ADV override
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//_ppd($_REQUEST);
|
||||
$focus->job_interval = $_REQUEST['mins']."::".$_REQUEST['hours']."::".$_REQUEST['day_of_month']."::".$_REQUEST['months']."::".$_REQUEST['day_of_week'];
|
||||
|
||||
|
||||
|
||||
|
||||
// deal with job types
|
||||
// neither
|
||||
if ( ($_REQUEST['job_function'] == '') && ($_REQUEST['job_url'] == '' || $_REQUEST['job_url'] == 'http://') ) {
|
||||
$GLOBALS['log']->fatal('Scheduler save did not get a job_url or job_function');
|
||||
} elseif ( ($_REQUEST['job_function'] != '') && ($_REQUEST['job_url'] != '' && $_REQUEST['job_url'] != 'http://') ) {
|
||||
$GLOBALS['log']->fatal('Scheduler got both a job_url and job_function');
|
||||
}
|
||||
//function
|
||||
if ( ($_REQUEST['job_function'] != '') && ($_REQUEST['job_url'] == '' || $_REQUEST['job_url'] == 'http://') ) {
|
||||
$focus->job = $_REQUEST['job_function'];
|
||||
} elseif ( ($_REQUEST['job_function'] == '') && ($_REQUEST['job_url'] != '' && $_REQUEST['job_url'] != 'http://') ) { // url
|
||||
$focus->job = 'url::'.$_REQUEST['job_url'];
|
||||
} // url wins if both passed
|
||||
|
||||
// save should refresh ALL jobs
|
||||
$focus->save();
|
||||
$return_id = $focus->id;
|
||||
|
||||
$edit='';
|
||||
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
|
||||
else $return_module = "Schedulers";
|
||||
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
|
||||
else $return_action = "DetailView";
|
||||
if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = $_REQUEST['return_id'];
|
||||
if(!empty($_REQUEST['edit'])) {
|
||||
$return_id='';
|
||||
$edit='edit=true';
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug("Saved record with id of ".$return_id);
|
||||
|
||||
header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&$edit");
|
||||
?>
|
||||
71
modules/Schedulers/Scheduled.html
Executable file
71
modules/Schedulers/Scheduled.html
Executable file
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description:
|
||||
* Created On: Sep 28, 2005
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): Chris Nojima
|
||||
********************************************************************************/
|
||||
-->
|
||||
|
||||
<!-- BEGIN: main -->
|
||||
<table cellpadding="0" cellspacing="{GRIDLINE}" width="100%" border="0" class="list view">
|
||||
<!-- BEGIN: list_nav_row -->
|
||||
{PAGINATION}
|
||||
<!-- END: list_nav_row -->
|
||||
<tr height="20">
|
||||
<td scope="col" width="30%" ><slot><a href="{ORDER_BY}job_id" class="listViewThLinkS1">{MOD.LBL_LIST_NAME}{arrow_start}{name_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="35%" ><slot><a href="{ORDER_BY}execute_time" class="listViewThLinkS1">{MOD.LBL_LIST_EXECUTE_TIME}{arrow_start}{execute_time_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="35%" ><slot><a href="{ORDER_BY}job_name" class="listViewThLinkS1">{MOD.LBL_JOB}{arrow_start}{job_arrow}{arrow_end}</a></slot></td>
|
||||
<td scope="col" width="5%" ><slot>{MOD.LBL_LIST_REMOVE}</slot></td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN: row -->
|
||||
<tr height="20" class="{ROW_COLOR}S1">
|
||||
<td scope='row' valign=TOP>
|
||||
<slot><a href="{URL_PREFIX}index.php?action=DetailView&module=Schedulers&record={JOB.JOB_ID}" >{JOB.JOB_NAME}</a></slot></td>
|
||||
<td valign=TOP>
|
||||
<slot>{JOB.EXECUTE_TIME}</slot></td>
|
||||
<td valign=TOP>
|
||||
<slot>{JOB.JOB}</slot></td>
|
||||
<td valign=TOP>
|
||||
<slot><a class="listViewTdToolsS1" onclick="return confirm('{MOD.NTC_DELETE_CONFIRMATION}')" href="{URL_PREFIX}index.php?action=DeleteScheduled&module=Schedulers&record={JOB.ID}&return_module=Schedulers&return_action=Scheduled&return_id=" >{REMOVE_INLINE_PNG}</a> <a class="listViewTdToolsS1" onclick="return confirm('{MOD.NTC_DELETE_CONFIRMATION}')" href="{URL_PREFIX}index.php?action=DeleteScheduled&module=Schedulers&record={JOB.ID}&return_module=Schedulers&return_action=Scheduled&return_id=">{APP.LNK_DELETE}</a></slot></td>
|
||||
</tr>
|
||||
<!-- END: row -->
|
||||
{PAGINATION}
|
||||
</table>
|
||||
<!-- END: main -->
|
||||
70
modules/Schedulers/Scheduled.php
Executable file
70
modules/Schedulers/Scheduled.php
Executable 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
require_once('modules/Schedulers/Job.php');
|
||||
|
||||
$header_text = '';
|
||||
global $mod_strings;
|
||||
global $app_list_strings;
|
||||
global $app_strings;
|
||||
global $current_user;
|
||||
|
||||
$focus = new Job();
|
||||
$focus->retrieve();
|
||||
$focus->get_list_view_data();
|
||||
|
||||
//_pp($_REQUEST);
|
||||
$where = '';
|
||||
$limit = 20;
|
||||
$varName = $focus->object_name;
|
||||
$allowByOverride = true;
|
||||
if(!empty($_REQUEST['Schedulers_'.$varName.'_ORDER_BY'])) {
|
||||
$orderBy = $_REQUEST['Schedulers_'.$varName.'_ORDER_BY'];
|
||||
} else {
|
||||
$orderBy = $focus->order_by;
|
||||
}
|
||||
|
||||
$listView = new ListView();
|
||||
$listView->initNewXTemplate('modules/Schedulers/Scheduled.html', $mod_strings);
|
||||
$listView->setHeaderTitle($mod_strings['LBL_LIST_TITLE']);
|
||||
$listView->setQuery($where, $limit, $orderBy, $varName, $allowByOverride);
|
||||
$listView->xTemplateAssign("REMOVE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" alt="'.$app_strings['LNK_REMOVE'].'" border="0"'));
|
||||
$listView->processListView($focus, "main", "JOB");
|
||||
|
||||
?>
|
||||
1114
modules/Schedulers/Scheduler.php
Executable file
1114
modules/Schedulers/Scheduler.php
Executable file
File diff suppressed because it is too large
Load Diff
573
modules/Schedulers/SchedulerDaemon.php
Executable file
573
modules/Schedulers/SchedulerDaemon.php
Executable file
@@ -0,0 +1,573 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
class SchedulerDaemon extends Scheduler {
|
||||
// schema columns
|
||||
var $id;
|
||||
var $deleted;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $job_id;
|
||||
var $execute_time;
|
||||
// replicated SugarBean attributes
|
||||
var $db;
|
||||
// object attributes
|
||||
var $object_name = 'SchedulerDaemon';
|
||||
var $table_name = 'schedulers_times';
|
||||
var $job_array;
|
||||
var $watch_name; // this object's watch name
|
||||
var $sleepInterval = 5; // how long to sleep before checking on jobs
|
||||
var $lifespan = 45; // 2 mins to kill off this object
|
||||
var $sessId; // admin PHPSESSID
|
||||
var $runAsUserName; // admin user
|
||||
var $runAsUserPassword; // admin pword
|
||||
var $stop = false;
|
||||
var $uptimeMonitor;
|
||||
var $shutdown = false;
|
||||
|
||||
|
||||
/**
|
||||
* Sole constructor.
|
||||
*/
|
||||
function SchedulerDaemon () {
|
||||
if(empty($this->db)) {
|
||||
|
||||
$this->db = DBManagerFactory::getInstance();
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug('New Scheduler Instantiated.....................................');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function takes a look at the schedulers_times table and pulls the
|
||||
* jobs to be run at this moment in time (anything not run and with a run
|
||||
* time or earlier than right now)
|
||||
* @return $successful Boolean flag whether a job(s) is found
|
||||
*/
|
||||
function checkPendingJobs() {
|
||||
global $sugar_config;
|
||||
global $current_user;
|
||||
|
||||
$GLOBALS['log']->debug('');
|
||||
$GLOBALS['log']->debug('----->Scheduler checking for qualified jobs to run.');
|
||||
if(empty($this->db)) {
|
||||
$this->db = DBManagerFactory::getInstance();
|
||||
}
|
||||
$fireTimeMinus = gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now -1 min'));
|
||||
$fireTimePlus = gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now +1 min'));
|
||||
|
||||
// collapse list of schedulers where "catch_up" is 0 and status is "ready" (not "in progress, completed, etc.");
|
||||
if($sugar_config['dbconfig']['db_type'] == 'oci8') {
|
||||
} else {
|
||||
$q = 'UPDATE schedulers_times st LEFT JOIN schedulers s ON st.scheduler_id = s.id SET st.status = \'not run\' WHERE st.execute_time < '.db_convert('\''.$fireTimeMinus.'\'', 'datetime').' AND st.status = \'ready\' AND s.catch_up = 0';
|
||||
}
|
||||
$this->db->query($q);
|
||||
|
||||
$q = 'SELECT DISTINCT st.id, st.scheduler_id, st.status, s.name, s.job FROM schedulers_times st LEFT JOIN schedulers s ON st.scheduler_id = s.id WHERE st.execute_time < '.db_convert('\''.$fireTimePlus.'\'', 'datetime').' AND st.deleted=0 AND s.deleted=0 AND st.status=\'ready\' AND s.status=\'Active\' ORDER BY s.name';
|
||||
$r = $this->db->query($q);
|
||||
$count = 0;
|
||||
|
||||
if($sugar_config['dbconfig']['db_type'] == 'mysql') {
|
||||
$loopCount = $this->db->getRowCount($r);
|
||||
$GLOBALS['log']->debug('----->Scheduler has '.$loopCount.' jobs to fire.');
|
||||
}
|
||||
|
||||
while($a = $this->db->fetchByAssoc($r)) {
|
||||
|
||||
$job = new SchedulersJob();
|
||||
|
||||
$paramJob = $a['scheduler_id'];
|
||||
$job->fire($sugar_config['site_url'].'/index.php?entryPoint=schedulers&type=job&job_id='.$paramJob.'&record='.$a['id']);
|
||||
$count++;
|
||||
}
|
||||
|
||||
|
||||
if($count < 1) {
|
||||
$GLOBALS['log']->debug('----->Scheduler has found 0 Jobs to fire');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes a Scheduler object and uses its job_interval
|
||||
* attribute to derive DB-standard datetime strings, as many as are
|
||||
* qualified by its ranges. The times are from the time of calling the
|
||||
* script.
|
||||
*
|
||||
* @param $focus Scheduler object
|
||||
* @return $dateTimes array loaded with DB datetime strings derived from
|
||||
* the job_interval attribute
|
||||
* @return false If we the Scheduler is not in scope, return false.
|
||||
*/
|
||||
function deriveDBDateTimes($focus) {
|
||||
$GLOBALS['log']->debug('deriveDBDateTimes got an object of type: '.$focus->object_name);
|
||||
/* [min][hr][dates][mon][days] */
|
||||
$dateTimes = array();
|
||||
$ints = explode('::', str_replace(' ','',$focus->job_interval));
|
||||
$days = $ints[4];
|
||||
$mons = $ints[3];
|
||||
$dates = $ints[2];
|
||||
$hrs = $ints[1];
|
||||
$mins = $ints[0];
|
||||
$today = getdate(gmmktime());
|
||||
|
||||
// derive day part
|
||||
if($days == '*') {
|
||||
$GLOBALS['log']->debug('got * day');
|
||||
|
||||
} elseif(strstr($days, '*/')) {
|
||||
// the "*/x" format is nonsensical for this field
|
||||
// do basically nothing.
|
||||
$theDay = str_replace('*/','',$days);
|
||||
$dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $theDay);
|
||||
} elseif($days != '*') { // got particular day(s)
|
||||
if(strstr($days, ',')) {
|
||||
$exDays = explode(',',$days);
|
||||
foreach($exDays as $k1 => $dayGroup) {
|
||||
if(strstr($dayGroup,'-')) {
|
||||
$exDayGroup = explode('-', $dayGroup); // build up range and iterate through
|
||||
for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) {
|
||||
$dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $i);
|
||||
}
|
||||
} else { // individuals
|
||||
$dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $dayGroup);
|
||||
}
|
||||
}
|
||||
} elseif(strstr($days, '-')) {
|
||||
$exDayGroup = explode('-', $days); // build up range and iterate through
|
||||
for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) {
|
||||
$dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $i);
|
||||
}
|
||||
} else {
|
||||
$dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $days);
|
||||
}
|
||||
|
||||
// check the day to be in scope:
|
||||
if(!in_array($today['weekday'], $dayName)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// derive months part
|
||||
if($mons == '*') {
|
||||
$GLOBALS['log']->debug('got * months');
|
||||
} elseif(strstr($mons, '*/')) {
|
||||
$mult = str_replace('*/','',$mons);
|
||||
$startMon = date(strtotime('m',$focus->date_time_start));
|
||||
$startFrom = ($startMon % $mult);
|
||||
|
||||
for($i=$startFrom;$i<=12;$i+$mult) {
|
||||
$compMons[] = $i+$mult;
|
||||
$i += $mult;
|
||||
}
|
||||
// this month is not in one of the multiplier months
|
||||
if(!in_array($today['mon'],$compMons)) {
|
||||
return false;
|
||||
}
|
||||
} elseif($mons != '*') {
|
||||
if(strstr($mons,',')) { // we have particular (groups) of months
|
||||
$exMons = explode(',',$mons);
|
||||
foreach($exMons as $k1 => $monGroup) {
|
||||
if(strstr($monGroup, '-')) { // we have a range of months
|
||||
$exMonGroup = explode('-',$monGroup);
|
||||
for($i=$exMonGroup[0];$i<=$exMonGroup[1];$i++) {
|
||||
$monName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$monName[] = $monGroup;
|
||||
}
|
||||
}
|
||||
} elseif(strstr($mons, '-')) {
|
||||
$exMonGroup = explode('-', $mons);
|
||||
for($i=$exMonGroup[0];$i<=$exMonGroup[1];$i++) {
|
||||
$monName[] = $i;
|
||||
}
|
||||
} else { // one particular month
|
||||
$monName[] = $mons;
|
||||
}
|
||||
|
||||
// check that particular months are in scope
|
||||
if(!in_array($today['mon'], $monName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// derive dates part
|
||||
if($dates == '*') {
|
||||
$GLOBALS['log']->debug('got * dates');
|
||||
} elseif(strstr($dates, '*/')) {
|
||||
$mult = str_replace('*/','',$dates);
|
||||
$startDate = date('d', strtotime($focus->date_time_start));
|
||||
$startFrom = ($startDate % $mult);
|
||||
|
||||
for($i=$startFrom; $i<=31; $i+$mult) {
|
||||
$dateName[] = str_pad(($i+$mult),2,'0',STR_PAD_LEFT);
|
||||
$i += $mult;
|
||||
}
|
||||
|
||||
if(!in_array($today['mday'], $dateName)) {
|
||||
return false;
|
||||
}
|
||||
} elseif($dates != '*') {
|
||||
if(strstr($dates, ',')) {
|
||||
$exDates = explode(',', $dates);
|
||||
foreach($exDates as $k1 => $dateGroup) {
|
||||
if(strstr($dateGroup, '-')) {
|
||||
$exDateGroup = explode('-', $dateGroup);
|
||||
for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) {
|
||||
$dateName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$dateName[] = $dateGroup;
|
||||
}
|
||||
}
|
||||
} elseif(strstr($dates, '-')) {
|
||||
$exDateGroup = explode('-', $dates);
|
||||
for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) {
|
||||
$dateName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$dateName[] = $dates;
|
||||
}
|
||||
|
||||
// check that dates are in scope
|
||||
if(!in_array($today['mday'], $dateName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// derive hours part
|
||||
//$startHour = date('G', strtotime($focus->date_time_start));
|
||||
//$currentHour = ($startHour < 1) ? 23 : date('G', strtotime($focus->date_time_start));
|
||||
$currentHour = date('G');
|
||||
if($hrs == '*') {
|
||||
$GLOBALS['log']->debug('got * hours');
|
||||
for($i=0;$i<=24; $i++) {
|
||||
if($currentHour + $i > 23) {
|
||||
$hrName[] = $currentHour + $i - 24;
|
||||
} else {
|
||||
$hrName[] = $currentHour + $i;
|
||||
}
|
||||
}
|
||||
} elseif(strstr($hrs, '*/')) {
|
||||
$mult = str_replace('*/','',$hrs);
|
||||
for($i=0; $i<24; $i) { // weird, i know
|
||||
if($currentHour + $i > 23) {
|
||||
$hrName[] = $currentHour + $i - 24;
|
||||
} else {
|
||||
$hrName[] = $currentHour + $i;
|
||||
}
|
||||
$i += $mult;
|
||||
}
|
||||
} elseif($hrs != '*') {
|
||||
if(strstr($hrs, ',')) {
|
||||
$exHrs = explode(',',$hrs);
|
||||
foreach($exHrs as $k1 => $hrGroup) {
|
||||
if(strstr($hrGroup, '-')) {
|
||||
$exHrGroup = explode('-', $hrGroup);
|
||||
for($i=$exHrGroup[0];$i<=$exHrGroup[1];$i++) {
|
||||
$hrName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$hrName[] = $hrGroup;
|
||||
}
|
||||
}
|
||||
} elseif(strstr($hrs, '-')) {
|
||||
$exHrs = explode('-', $hrs);
|
||||
for($i=$exHrs[0];$i<=$exHrs[1];$i++) {
|
||||
$hrName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$hrName[] = $hrs;
|
||||
}
|
||||
}
|
||||
// derive minutes
|
||||
$currentMin = date('i');
|
||||
if(substr($currentMin, 0, 1) == '0') {
|
||||
$currentMin = substr($currentMin, 1, 1);
|
||||
}
|
||||
if($mins == '*') {
|
||||
$GLOBALS['log']->debug('got * mins');
|
||||
for($i=0; $i<60; $i++) {
|
||||
if(($currentMin + $i) > 59) {
|
||||
$minName[] = ($i + $currentMin - 60);
|
||||
} else {
|
||||
$minName[] = ($i+$currentMin);
|
||||
}
|
||||
}
|
||||
} elseif(strstr($mins,'*/')) {
|
||||
$mult = str_replace('*/','',$mins);
|
||||
$startMin = date('i',strtotime($focus->date_time_start));
|
||||
$startFrom = ($startMin % $mult);
|
||||
|
||||
for($i=$startFrom; $i<=59; $i+$mult) {
|
||||
if(($currentMin + $i) > 59) {
|
||||
$minName[] = ($i + $currentMin - 60);
|
||||
} else {
|
||||
$minName[] = ($i+$currentMin);
|
||||
}
|
||||
$i += $mult;
|
||||
}
|
||||
} elseif($mins != '*') {
|
||||
if(strstr($mins, ',')) {
|
||||
$exMins = explode(',',$mins);
|
||||
foreach($exMins as $k1 => $minGroup) {
|
||||
if(strstr($minGroup, '-')) {
|
||||
$exMinGroup = explode('-', $minGroup);
|
||||
for($i=$exMinGroup[0]; $i<=$exMinGroup[1]; $i++) {
|
||||
$minName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$minName[] = $minGroup;
|
||||
}
|
||||
}
|
||||
} elseif(strstr($mins, '-')) {
|
||||
$exMinGroup = explode('-', $mins);
|
||||
for($i=$exMinGroup[0]; $i<=$exMinGroup[1]; $i++) {
|
||||
$minName[] = $i;
|
||||
}
|
||||
} else {
|
||||
$minName[] = $mins;
|
||||
}
|
||||
}
|
||||
|
||||
// prep some boundaries - these are not in GMT b/c gmt is a 24hour period, possibly bridging 2 local days
|
||||
if(empty($focus->time_from) && empty($focus->time_to) ) {
|
||||
$timeFromTs = 0;
|
||||
$timeToTs = strtotime('+1 day');
|
||||
} else {
|
||||
$timeFromTs = strtotime($focus->time_from); // these are now GMT (timestamps are all GMT)
|
||||
$timeToTs = strtotime($focus->time_to); // see above
|
||||
if($timeFromTs > $timeToTs) { // we've crossed into the next day
|
||||
$timeToTs = strtotime('+1 day '. $focus->time_to); // also in GMT
|
||||
}
|
||||
}
|
||||
$timeToTs++;
|
||||
|
||||
if(empty($focus->last_run)) {
|
||||
$lastRunTs = 0;
|
||||
} else {
|
||||
$lastRunTs = strtotime($focus->last_run);
|
||||
}
|
||||
|
||||
|
||||
// now smush the arrays together =)
|
||||
$validJobTime = array();
|
||||
global $timedate;
|
||||
$dts = explode(' ',$focus->date_time_start); // split up datetime field into date & time
|
||||
|
||||
$dts2 = $timedate->to_db_date_time($dts[0],$dts[1]); // get date/time into DB times (GMT)
|
||||
$dateTimeStart = $dts2[0]." ".$dts2[1];
|
||||
$timeStartTs = strtotime($dateTimeStart);
|
||||
if(!empty($focus->date_time_end) && !$focus->date_time_end == '2021-01-01 07:59:00') { // do the same for date_time_end if not empty
|
||||
$dte = explode(' ', $focus->date_time_end);
|
||||
$dte2 = $timedate->to_db_date_time($dte[0],$dte[1]);
|
||||
$dateTimeEnd = $dte2[0]." ".$dte2[1];
|
||||
} else {
|
||||
$dateTimeEnd = date('Y-m-d H:i:s', strtotime('+1 day'));
|
||||
// $dateTimeEnd = '2020-12-31 23:59:59'; // if empty, set it to something ridiculous
|
||||
}
|
||||
$timeEndTs = strtotime($dateTimeEnd); // GMT end timestamp if necessary
|
||||
$timeEndTs++;
|
||||
/*_pp('hours:'); _pp($hrName);_pp('mins:'); _pp($minName);*/
|
||||
$nowTs = mktime();
|
||||
|
||||
// _pp('currentHour: '. $currentHour);
|
||||
// _pp('timeStartTs: '.date('r',$timeStartTs));
|
||||
// _pp('timeFromTs: '.date('r',$timeFromTs));
|
||||
// _pp('timeEndTs: '.date('r',$timeEndTs));
|
||||
// _pp('timeToTs: '.date('r',$timeToTs));
|
||||
// _pp('mktime: '.date('r',mktime()));
|
||||
// _pp('timeLastRun: '.date('r',$lastRunTs));
|
||||
//
|
||||
// _pp('hours: ');
|
||||
// _pp($hrName);
|
||||
// _pp('mins: ');
|
||||
// _ppd($minName);
|
||||
$hourSeen = 0;
|
||||
foreach($hrName as $kHr=>$hr) {
|
||||
$hourSeen++;
|
||||
foreach($minName as $kMin=>$min) {
|
||||
if($hr < $currentHour || $hourSeen == 25) {
|
||||
$theDate = date('Y-m-d', strtotime('+1 day'));
|
||||
} else {
|
||||
$theDate = date('Y-m-d');
|
||||
}
|
||||
|
||||
$tsGmt = strtotime($theDate.' '.str_pad($hr,2,'0',STR_PAD_LEFT).":".str_pad($min,2,'0',STR_PAD_LEFT).":00"); // this is LOCAL
|
||||
// _pp(date('Y-m-d H:i:s',$tsGmt));
|
||||
|
||||
if( $tsGmt >= $timeStartTs ) { // start is greater than the date specified by admin
|
||||
if( $tsGmt >= $timeFromTs ) { // start is greater than the time_to spec'd by admin
|
||||
if( $tsGmt <= $timeEndTs ) { // this is taken care of by the initial query - start is less than the date spec'd by admin
|
||||
if( $tsGmt <= $timeToTs ) { // start is less than the time_to
|
||||
if( $tsGmt >= $nowTs ) { // we only want to add jobs that are in the future
|
||||
if( $tsGmt > $lastRunTs ) { //TODO figure if this is better than the above check
|
||||
$validJobTime[] = gmdate('Y-m-d H:i:s', $tsGmt);
|
||||
//_pp("Job Qualified for: ".date('Y-m-d H:i:s', $tsGmt));
|
||||
} else {
|
||||
//_pp('Job Time is NOT greater than Last Run');
|
||||
}
|
||||
} else {
|
||||
//_pp('Job Time is NOT larger than NOW'); _pp(date('Y-m-d H:i:s', $nowTs));
|
||||
}
|
||||
} else {
|
||||
//_pp('Job Time is NOT smaller that TimeTO: '.$tsGmt .'<='. $timeToTs);
|
||||
}
|
||||
} else {
|
||||
//_pp('Job Time is NOT smaller that DateTimeEnd: '.date('Y-m-d H:i:s',$tsGmt) .'<='. $dateTimeEnd); _pp( $tsGmt .'<='. $timeEndTs );
|
||||
}
|
||||
} else {
|
||||
//_pp('Job Time is NOT bigger that TimeFrom: '.$tsGmt .'>='. $timeFromTs);
|
||||
}
|
||||
} else {
|
||||
//_pp('Job Time is NOT Bigger than DateTimeStart: '.date('Y-m-d H:i',$tsGmt) .'>='. $dateTimeStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
// _ppd();
|
||||
// _ppd($validJobTime);
|
||||
return $validJobTime;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes an array of jobs build up by retrieveSchedulers and
|
||||
* puts them into the schedulers_times table
|
||||
*/
|
||||
function insertSchedules() {
|
||||
$GLOBALS['log']->info('----->Scheduler retrieving scheduled items and adding them to Job queue.');
|
||||
$jobsArr = $this->retrieveSchedulers();
|
||||
if(is_array($jobsArr['ids']) && !empty($jobsArr['ids']) && is_array($jobsArr['times']) && !empty($jobsArr['times'])) {
|
||||
foreach($jobsArr['ids'] as $k => $ids) {
|
||||
foreach($jobsArr['times'][$k] as $j => $time) {
|
||||
$guid = create_guid();
|
||||
$q = "INSERT INTO schedulers_times
|
||||
(id, deleted, date_entered, date_modified, scheduler_id, execute_time, status)
|
||||
VALUES (
|
||||
'".$guid."',
|
||||
0,
|
||||
".db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'", 'datetime').",
|
||||
".db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'", 'datetime').",
|
||||
'".$jobsArr['ids'][$k]."',
|
||||
".db_convert("'".$time."'", 'datetime').",
|
||||
'ready'
|
||||
)";
|
||||
$this->db->query($q);
|
||||
$GLOBALS['log']->info('Query: '.$q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function drops all rows in the schedulers_times table.
|
||||
*/
|
||||
function dropSchedules($truncate=false) {
|
||||
global $sugar_config;
|
||||
|
||||
if(empty($this->db)) {
|
||||
$this->db = DBManagerFactory::getInstance();
|
||||
}
|
||||
|
||||
if($truncate) {
|
||||
if($sugar_config['dbconfig']['db_type'] == 'oci8') {
|
||||
} else {
|
||||
$query = 'TRUNCATE schedulers_times';
|
||||
}
|
||||
$this->db->query($query);
|
||||
$GLOBALS['log']->debug('----->Scheduler TRUNCATED ALL Jobs: '.$query);
|
||||
} else {
|
||||
$query = 'UPDATE schedulers_times SET deleted = 1';
|
||||
$this->db->query($query);
|
||||
$GLOBALS['log']->debug('----->Scheduler soft deleting all Jobs: '.$query);
|
||||
}
|
||||
//TODO make sure this will fail gracefully
|
||||
}
|
||||
|
||||
/**
|
||||
* This function retrieves valid jobs, parses the cron format, then returns
|
||||
* an array of [JOB_ID][EXEC_TIME][JOB]
|
||||
*
|
||||
* @return $executeJobs multi-dimensional array
|
||||
* [job_id][execute_time]
|
||||
*/
|
||||
function retrieveSchedulers() {
|
||||
$GLOBALS['log']->info('Gathering Schedulers');
|
||||
$executeJobs = array();
|
||||
$query = "SELECT id " .
|
||||
"FROM schedulers " .
|
||||
"WHERE deleted=0 " .
|
||||
"AND status = 'Active' " .
|
||||
"AND date_time_start < ".db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'",'datetime')." " .
|
||||
"AND (date_time_end > ".db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'",'datetime')." OR date_time_end IS NULL)";
|
||||
|
||||
$result = $this->db->query($query);
|
||||
$rows=0;
|
||||
$executeTimes = array();
|
||||
$executeIds = array();
|
||||
$executeJobTimes = array();
|
||||
while(($arr = $this->db->fetchByAssoc($result)) != null) {
|
||||
$focus = new Scheduler();
|
||||
$focus->retrieve($arr['id']);
|
||||
$executeTimes[$rows] = $this->deriveDBDateTimes($focus);
|
||||
if(count($executeTimes) > 0) {
|
||||
foreach($executeTimes as $k => $time) {
|
||||
$executeIds[$rows] = $focus->id;
|
||||
$executeJobTimes[$rows] = $time;
|
||||
}
|
||||
}
|
||||
$rows++;
|
||||
}
|
||||
$executeJobs['ids'] = $executeIds;
|
||||
$executeJobs['times'] = $executeJobTimes;
|
||||
return $executeJobs;
|
||||
}
|
||||
|
||||
} // end SchedulerDaemon class desc.
|
||||
|
||||
?>
|
||||
549
modules/Schedulers/_AddJobsHere.php
Normal file
549
modules/Schedulers/_AddJobsHere.php
Normal file
@@ -0,0 +1,549 @@
|
||||
<?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".
|
||||
* ******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set up an array of Jobs with the appropriate metadata
|
||||
* 'jobName' => array (
|
||||
* 'X' => 'name',
|
||||
* )
|
||||
* 'X' should be an increment of 1
|
||||
* 'name' should be the EXACT name of your function
|
||||
*
|
||||
* Your function should not be passed any parameters
|
||||
* Always return a Boolean. If it does not the Job will not terminate itself
|
||||
* after completion, and the webserver will be forced to time-out that Job instance.
|
||||
* DO NOT USE sugar_cleanup(); in your function flow or includes. this will
|
||||
* break Schedulers. That function is called at the foot of cron.php
|
||||
*/
|
||||
|
||||
/**
|
||||
* This array provides the Schedulers admin interface with values for its "Job"
|
||||
* dropdown menu.
|
||||
*/
|
||||
$job_strings = array (
|
||||
0 => 'refreshJobs',
|
||||
1 => 'pollMonitoredInboxes',
|
||||
2 => 'runMassEmailCampaign',
|
||||
5 => 'pollMonitoredInboxesForBouncedCampaignEmails',
|
||||
3 => 'pruneDatabase',
|
||||
4 => 'trimTracker',
|
||||
6 => 'checkEDISales',
|
||||
7 => 'mailingsE5'
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
* Job 0 refreshes all job schedulers at midnight
|
||||
* DEPRECATED
|
||||
*/
|
||||
function refreshJobs() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function mailingsE5(){
|
||||
|
||||
require_once ('modules/Schedulers/MailingCron.php');
|
||||
$mailingCron = new MailingCron ();
|
||||
$mailingCron->getMalingToSend ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 1
|
||||
*/
|
||||
function pollMonitoredInboxes() {
|
||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type pollMonitoredInboxes()' );
|
||||
global $dictionary;
|
||||
global $app_strings;
|
||||
|
||||
require_once ('modules/Emails/EmailUI.php');
|
||||
|
||||
$ie = new InboundEmail ();
|
||||
$emailUI = new EmailUI ();
|
||||
$r = $ie->db->query ( 'SELECT id, name FROM inbound_email WHERE is_personal = 0 AND deleted=0 AND status=\'Active\' AND mailbox_type != \'bounce\'' );
|
||||
$GLOBALS ['log']->debug ( 'Just got Result from get all Inbounds of Inbound Emails' );
|
||||
|
||||
while ( $a = $ie->db->fetchByAssoc ( $r ) ) {
|
||||
$GLOBALS ['log']->debug ( 'In while loop of Inbound Emails' );
|
||||
$ieX = new InboundEmail ();
|
||||
$ieX->retrieve ( $a ['id'] );
|
||||
$mailboxes = $ieX->mailboxarray;
|
||||
foreach ( $mailboxes as $mbox ) {
|
||||
$ieX->mailbox = $mbox;
|
||||
$newMsgs = array ();
|
||||
$msgNoToUIDL = array ();
|
||||
$connectToMailServer = false;
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$msgNoToUIDL = $ieX->getPop3NewMessagesToDownloadForCron ();
|
||||
// get all the keys which are msgnos;
|
||||
$newMsgs = array_keys ( $msgNoToUIDL );
|
||||
}
|
||||
if ($ieX->connectMailserver () == 'true') {
|
||||
$connectToMailServer = true;
|
||||
} // if
|
||||
|
||||
$GLOBALS ['log']->debug ( 'Trying to connect to mailserver for [ ' . $a ['name'] . ' ]' );
|
||||
if ($connectToMailServer) {
|
||||
$GLOBALS ['log']->debug ( 'Connected to mailserver' );
|
||||
if (! $ieX->isPop3Protocol ()) {
|
||||
$newMsgs = $ieX->getNewMessageIds ();
|
||||
}
|
||||
if (is_array ( $newMsgs )) {
|
||||
$current = 1;
|
||||
$total = count ( $newMsgs );
|
||||
require_once ("include/SugarFolders/SugarFolders.php");
|
||||
$sugarFolder = new SugarFolder ();
|
||||
$groupFolderId = $ieX->groupfolder_id;
|
||||
$isGroupFolderExists = false;
|
||||
$users = array ();
|
||||
if ($groupFolderId != null && $groupFolderId != "") {
|
||||
$sugarFolder->retrieve ( $groupFolderId );
|
||||
$isGroupFolderExists = true;
|
||||
} // if
|
||||
$messagesToDelete = array ();
|
||||
if ($ieX->isMailBoxTypeCreateCase ()) {
|
||||
$users [] = $sugarFolder->assign_to_id;
|
||||
$distributionMethod = $ieX->get_stored_options ( "distrib_method", "" );
|
||||
if ($distributionMethod != 'roundRobin') {
|
||||
$counts = $emailUI->getAssignedEmailsCountForUsers ( $users );
|
||||
} else {
|
||||
$lastRobin = $emailUI->getLastRobin ( $ieX );
|
||||
}
|
||||
$GLOBALS ['log']->debug ( 'distribution method id [ ' . $distributionMethod . ' ]' );
|
||||
}
|
||||
foreach ( $newMsgs as $k => $msgNo ) {
|
||||
$uid = $msgNo;
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$uid = $msgNoToUIDL [$msgNo];
|
||||
} else {
|
||||
$uid = imap_uid ( $ieX->conn, $msgNo );
|
||||
} // else
|
||||
if ($isGroupFolderExists) {
|
||||
if ($ieX->importOneEmail ( $msgNo, $uid )) {
|
||||
// add to folder
|
||||
$sugarFolder->addBean ( $ieX->email );
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$messagesToDelete [] = $msgNo;
|
||||
} else {
|
||||
$messagesToDelete [] = $uid;
|
||||
}
|
||||
if ($ieX->isMailBoxTypeCreateCase ()) {
|
||||
$userId = "";
|
||||
if ($distributionMethod == 'roundRobin') {
|
||||
if (sizeof ( $users ) == 1) {
|
||||
$userId = $users [0];
|
||||
$lastRobin = $users [0];
|
||||
} else {
|
||||
$userIdsKeys = array_flip ( $users ); // now keys are values
|
||||
$thisRobinKey = $userIdsKeys [$lastRobin] + 1;
|
||||
if (! empty ( $users [$thisRobinKey] )) {
|
||||
$userId = $users [$thisRobinKey];
|
||||
$lastRobin = $users [$thisRobinKey];
|
||||
} else {
|
||||
$userId = $users [0];
|
||||
$lastRobin = $users [0];
|
||||
}
|
||||
} // else
|
||||
} else {
|
||||
if (sizeof ( $users ) == 1) {
|
||||
foreach ( $users as $k => $value ) {
|
||||
$userId = $value;
|
||||
} // foreach
|
||||
} else {
|
||||
asort ( $counts ); // lowest to highest
|
||||
$countsKeys = array_flip ( $counts ); // keys now the 'count of items'
|
||||
$leastBusy = array_shift ( $countsKeys ); // user id of lowest item count
|
||||
$userId = $leastBusy;
|
||||
$counts [$leastBusy] = $counts [$leastBusy] + 1;
|
||||
}
|
||||
} // else
|
||||
$GLOBALS ['log']->debug ( 'userId [ ' . $userId . ' ]' );
|
||||
$ieX->handleCreateCase ( $ieX->email, $userId );
|
||||
} // if
|
||||
} // if
|
||||
} else {
|
||||
if ($ieX->isAutoImport ()) {
|
||||
$ieX->importOneEmail ( $msgNo, $uid );
|
||||
} else {
|
||||
/*
|
||||
* If the group folder doesn't exist then download only those messages
|
||||
* which has caseid in message
|
||||
*/
|
||||
$ieX->getMessagesInEmailCache ( $msgNo, $uid );
|
||||
$email = new Email ();
|
||||
$header = imap_headerinfo ( $ieX->conn, $msgNo );
|
||||
$email->name = $ieX->handleMimeHeaderDecode ( $header->subject );
|
||||
$email->from_addr = $ieX->convertImapToSugarEmailAddress ( $header->from );
|
||||
$email->reply_to_email = $ieX->convertImapToSugarEmailAddress ( $header->reply_to );
|
||||
if (! empty ( $email->reply_to_email )) {
|
||||
$contactAddr = $email->reply_to_email;
|
||||
} else {
|
||||
$contactAddr = $email->from_addr;
|
||||
}
|
||||
$mailBoxType = $ieX->mailbox_type;
|
||||
$ieX->handleAutoresponse ( $email, $contactAddr );
|
||||
} // else
|
||||
} // else
|
||||
$GLOBALS ['log']->debug ( '***** On message [ ' . $current . ' of ' . $total . ' ] *****' );
|
||||
$current ++;
|
||||
} // foreach
|
||||
// update Inbound Account with last robin
|
||||
if ($ieX->isMailBoxTypeCreateCase () && $distributionMethod == 'roundRobin') {
|
||||
$emailUI->setLastRobin ( $ieX, $lastRobin );
|
||||
} // if
|
||||
} // if
|
||||
if ($isGroupFolderExists) {
|
||||
$leaveMessagesOnMailServer = $ieX->get_stored_options ( "leaveMessagesOnMailServer", 0 );
|
||||
if (! $leaveMessagesOnMailServer) {
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$ieX->deleteMessageOnMailServerForPop3 ( implode ( ",", $messagesToDelete ) );
|
||||
} else {
|
||||
$ieX->deleteMessageOnMailServer ( implode ( $app_strings ['LBL_EMAIL_DELIMITER'], $messagesToDelete ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$GLOBALS ['log']->fatal ( "SCHEDULERS: could not get an IMAP connection resource for ID [ {$a['id']} ]. Skipping mailbox [ {$a['name']} ]." );
|
||||
// cn: bug 9171 - continue while
|
||||
} // else
|
||||
} // foreach
|
||||
imap_expunge ( $ieX->conn );
|
||||
imap_close ( $ieX->conn, CL_EXPUNGE );
|
||||
} // while
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 2
|
||||
*/
|
||||
function runMassEmailCampaign() {
|
||||
if (! class_exists ( 'LoggerManager' )) {
|
||||
}
|
||||
$GLOBALS ['log'] = LoggerManager::getLogger ( 'emailmandelivery' );
|
||||
$GLOBALS ['log']->debug ( 'Called:runMassEmailCampaign' );
|
||||
|
||||
if (! class_exists ( 'DBManagerFactory' )) {
|
||||
require ('include/database/DBManagerFactory.php');
|
||||
}
|
||||
|
||||
global $beanList;
|
||||
global $beanFiles;
|
||||
require ("config.php");
|
||||
require ('include/modules.php');
|
||||
if (! class_exists ( 'AclController' )) {
|
||||
require ('modules/ACL/ACLController.php');
|
||||
}
|
||||
|
||||
require ('modules/EmailMan/EmailManDelivery.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 3
|
||||
*/
|
||||
function pruneDatabase() {
|
||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type pruneDatabase()' );
|
||||
$backupDir = $GLOBALS ['sugar_config'] ['cache_dir'] . 'backups';
|
||||
$backupFile = 'backup-pruneDatabase-GMT0_' . gmdate ( 'Y_m_d-H_i_s', strtotime ( 'now' ) ) . '.php';
|
||||
|
||||
$db = DBManagerFactory::getInstance ();
|
||||
$tables = $db->getTablesArray ();
|
||||
|
||||
// _ppd($tables);
|
||||
if (! empty ( $tables )) {
|
||||
foreach ( $tables as $kTable => $table ) {
|
||||
// find tables with deleted=1
|
||||
$qDel = 'SELECT * FROM ' . $table . ' WHERE deleted = 1';
|
||||
$rDel = $db->query ( $qDel ); // OR continue; // continue if no 'deleted' column
|
||||
|
||||
// make a backup INSERT query if we are deleting.
|
||||
while ( $aDel = $db->fetchByAssoc ( $rDel ) ) {
|
||||
// build column names
|
||||
$rCols = $db->query ( 'SHOW COLUMNS FROM ' . $table );
|
||||
$colName = array ();
|
||||
|
||||
while ( $aCols = $db->fetchByAssoc ( $rCols ) ) {
|
||||
$colName [] = $aCols ['Field'];
|
||||
}
|
||||
|
||||
$query = 'INSERT INTO ' . $table . ' (';
|
||||
$values = '';
|
||||
foreach ( $colName as $kC => $column ) {
|
||||
$query .= $column . ', ';
|
||||
$values .= '"' . $aDel [$column] . '", ';
|
||||
}
|
||||
|
||||
$query = substr ( $query, 0, (strlen ( $query ) - 2) );
|
||||
$values = substr ( $values, 0, (strlen ( $values ) - 2) );
|
||||
$query .= ') VALUES (' . str_replace ( "'", "'", $values ) . ');';
|
||||
|
||||
$queryString [] = $query;
|
||||
|
||||
if (empty ( $colName )) {
|
||||
$GLOBALS ['log']->fatal ( 'pruneDatabase() could not get the columns for table (' . $table . ')' );
|
||||
}
|
||||
} // end aDel while()
|
||||
// now do the actual delete
|
||||
$db->query ( 'DELETE FROM ' . $table . ' WHERE deleted = 1' );
|
||||
} // foreach() tables
|
||||
|
||||
// now output file with SQL
|
||||
if (! function_exists ( 'mkdir_recursive' )) {
|
||||
}
|
||||
if (! function_exists ( 'write_array_to_file' )) {
|
||||
}
|
||||
if (! file_exists ( $backupDir ) || ! file_exists ( $backupDir . '/' . $backupFile )) {
|
||||
// create directory if not existent
|
||||
mkdir_recursive ( $backupDir, false );
|
||||
}
|
||||
// write cache file
|
||||
|
||||
write_array_to_file ( 'pruneDatabase', $queryString, $backupDir . '/' . $backupFile );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Job 4
|
||||
// */
|
||||
|
||||
// function securityAudit() {
|
||||
// // do something
|
||||
// return true;
|
||||
// }
|
||||
function trimTracker() {
|
||||
global $sugar_config;
|
||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type trimTracker()' );
|
||||
$db = DBManagerFactory::getInstance ();
|
||||
|
||||
$admin = new Administration ();
|
||||
$admin->retrieveSettings ( 'tracker' );
|
||||
require ('modules/Trackers/config.php');
|
||||
$trackerConfig = $tracker_config;
|
||||
|
||||
require_once ('include/utils/db_utils.php');
|
||||
$prune_interval = ! empty ( $admin->settings ['tracker_prune_interval'] ) ? $admin->settings ['tracker_prune_interval'] : 30;
|
||||
foreach ( $trackerConfig as $tableName => $tableConfig ) {
|
||||
|
||||
// Skip if table does not exist
|
||||
if (! $db->tableExists ( $tableName )) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$timeStamp = db_convert ( "'" . gmdate ( $GLOBALS ['timedate']->get_db_date_time_format (), time () + (86400 * - $prune_interval) ) . "'", "datetime" );
|
||||
if ($tableName == 'tracker_sessions') {
|
||||
$query = "DELETE FROM $tableName WHERE date_end < $timeStamp";
|
||||
} else {
|
||||
$query = "DELETE FROM $tableName WHERE date_modified < $timeStamp";
|
||||
}
|
||||
|
||||
$GLOBALS ['log']->info ( "----->Scheduler is about to trim the $tableName table by running the query $query" );
|
||||
$db->query ( $query );
|
||||
} // foreach
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Job 5
|
||||
*
|
||||
*/
|
||||
function pollMonitoredInboxesForBouncedCampaignEmails() {
|
||||
$GLOBALS ['log']->info ( '----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()' );
|
||||
global $dictionary;
|
||||
|
||||
$ie = new InboundEmail ();
|
||||
$r = $ie->db->query ( 'SELECT id FROM inbound_email WHERE deleted=0 AND status=\'Active\' AND mailbox_type=\'bounce\'' );
|
||||
|
||||
while ( $a = $ie->db->fetchByAssoc ( $r ) ) {
|
||||
$ieX = new InboundEmail ();
|
||||
$ieX->retrieve ( $a ['id'] );
|
||||
$ieX->connectMailserver ();
|
||||
|
||||
$newMsgs = array ();
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$newMsgs = $ieX->getPop3NewMessagesToDownload ();
|
||||
} else {
|
||||
$newMsgs = $ieX->getNewMessageIds ();
|
||||
}
|
||||
|
||||
// $newMsgs = $ieX->getNewMessageIds();
|
||||
if (is_array ( $newMsgs )) {
|
||||
foreach ( $newMsgs as $k => $msgNo ) {
|
||||
$uid = $msgNo;
|
||||
if ($ieX->isPop3Protocol ()) {
|
||||
$uid = $ieX->getUIDLForMessage ( $msgNo );
|
||||
} else {
|
||||
$uid = imap_uid ( $ieX->conn, $msgNo );
|
||||
} // else
|
||||
|
||||
$ieX->importOneEmail ( $msgNo, $uid, false, false );
|
||||
}
|
||||
}
|
||||
imap_expunge ( $ieX->conn );
|
||||
imap_close ( $ieX->conn );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkEDISales() {
|
||||
require_once ('modules/EcmSales/EcmSale.php');
|
||||
require_once ('modules/EcmSales/readXML.php');
|
||||
|
||||
require_once 'include/phpMailer2/class.phpmailer.php';
|
||||
require_once 'include/phpMailer2/class.smtp.php';
|
||||
|
||||
$path = '/var/edi/e5/orders';
|
||||
$folders = array (
|
||||
'archive',
|
||||
'temp',
|
||||
'confirm'
|
||||
); // do not read this folders
|
||||
|
||||
$orders = array ();
|
||||
if (is_dir ( $path )) {
|
||||
if ($dh = opendir ( $path )) {
|
||||
while ( ($file = readdir ( $dh )) !== false ) {
|
||||
if (! is_dir ( $file ) && ! in_array ( $file, $folders )) {
|
||||
$orders [] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add orders
|
||||
$mail_msg = array ();
|
||||
foreach ( $orders as $order ) {
|
||||
$s = new EcmSale ();
|
||||
$reader = new readXML ();
|
||||
$reader->loadXMLFile ( $order );
|
||||
$reader->loader ( $s );
|
||||
$s->position_list = $reader->getPositionList ( true );
|
||||
$missedProducts = $reader->checkProducts($s->position_list);
|
||||
$number = $s->generateNumber ();
|
||||
$s->number = $number;
|
||||
$s->document_no = $s->formatNumber ( $number );
|
||||
$s->edi_file = $order;
|
||||
$s->type = 'sales_order';
|
||||
$s->status = 's30';
|
||||
$s->ecmlanguage = 'pl_pl';
|
||||
$a = new Account ();
|
||||
$a->retrieve ( $s->parent_id );
|
||||
$s->assigned_user_id = $a->assigned_user_id;
|
||||
$s->assigned_user_name = $a->assigned_user_name;
|
||||
// calculate totals
|
||||
$sum_netto = 0;
|
||||
$sum_brutto = 0;
|
||||
foreach ( $s->position_list as $p ) {
|
||||
$sum_netto += $p ['total_netto'];
|
||||
$sum_brutto += $p ['total_brutto'];
|
||||
}
|
||||
$s->total_netto = $sum_netto;
|
||||
|
||||
if($s->parent_id==134 || $s->parent_id=='134'){
|
||||
$s->shop_number = null;
|
||||
}
|
||||
|
||||
$s->total_brutto = $sum_brutto;
|
||||
$s->save ();
|
||||
|
||||
$s->sendSoap($s->id);
|
||||
|
||||
|
||||
if (!is_array($mail_msg [$a->assigned_user_id]))
|
||||
$mail_msg [$a->assigned_user_id] = array ();
|
||||
if (!$s->parent_name || $s->parent_name=="")
|
||||
$s->parent_name = 'Błąd! Brak kontrahenta!';
|
||||
$msg =
|
||||
'<b>Plik: '.$order.'</b><br>'.$s->document_no.', '.$s->parent_document_no.', '. $s->parent_name.'<br>';
|
||||
if (count($missedProducts) == 0) {
|
||||
$msg.='Status produktów: <b>OK</b>';
|
||||
} else {
|
||||
$msg.='<b>Zamówienie niekompletne: '.implode(', ', $missedProducts);
|
||||
}
|
||||
$msg.='<br><br><br>';
|
||||
$mail_msg [$a->assigned_user_id][] = $msg;
|
||||
unset($a);
|
||||
// move files
|
||||
rename ( $path . '/' . $order, $path . '/archive/' . $order );
|
||||
}
|
||||
//send messages
|
||||
// require_once 'modules/Schedulers/phpMailer.php';
|
||||
foreach ( $mail_msg as $user=>$msg ) {
|
||||
$u = new User();
|
||||
$u->retrieve($user);
|
||||
|
||||
$message = $date = date('Y-m-d H:i:s').' dodano zamówienie(a):<br>';
|
||||
foreach ($msg as $m) {
|
||||
$message .= $m.'<br>';
|
||||
}
|
||||
|
||||
$mail = new PHPMailer2 ();
|
||||
$mail->isSMTP();
|
||||
$mail->setFrom('system@e5.pl', 'Usługa importu EDI');
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'system@e5.pl';
|
||||
$mail->Password = 'eT4U>hyJe';
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = 587;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->addAddress('mz@bim-it.pl', 'Michał Zieliński');
|
||||
$mail->addAddress('rl@e5.pl', 'Ryszard Lisiecki');
|
||||
$mail->addAddress('mf@e5.pl', 'Małgorzata Franiewska');
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = "Import zamówienia EDI - E5" ;
|
||||
$mail->Body = $message;
|
||||
$mail->send();
|
||||
|
||||
unset ( $mS ); // cleaning
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (file_exists ( 'custom/modules/Schedulers/_AddJobsHere.php' )) {
|
||||
require ('custom/modules/Schedulers/_AddJobsHere.php');
|
||||
}
|
||||
|
||||
?>
|
||||
89
modules/Schedulers/field_arrays.php
Executable file
89
modules/Schedulers/field_arrays.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
$fields_array['Scheduler'] = array (
|
||||
'column_fields' => array(
|
||||
'id',
|
||||
'deleted',
|
||||
'date_entered',
|
||||
'date_modified',
|
||||
'modified_user_id',
|
||||
'created_by',
|
||||
'name',
|
||||
'job',
|
||||
'date_time_start',
|
||||
'date_time_end',
|
||||
'job_interval',
|
||||
'time_from',
|
||||
'time_to',
|
||||
'last_run',
|
||||
'status',
|
||||
'catch_up',
|
||||
),
|
||||
'list_fields' => array(
|
||||
'id',
|
||||
'name',
|
||||
'list_order',
|
||||
'status'
|
||||
),
|
||||
'required_fields' => array(
|
||||
'name' => 1,
|
||||
'list_order' => 1,
|
||||
'status' => 1
|
||||
),
|
||||
);
|
||||
|
||||
$fields_array['Job'] = array (
|
||||
'column_fields' => array (
|
||||
'id',
|
||||
'deleted',
|
||||
'date_entered',
|
||||
'date_modified',
|
||||
'job_id',
|
||||
'execute_time',
|
||||
'status',
|
||||
),
|
||||
'list_fields' => array (
|
||||
'id',
|
||||
'job_id',
|
||||
'execute_time'
|
||||
),
|
||||
'required_fields' => array (
|
||||
'job_id' => 1,
|
||||
'execute_time' => 1
|
||||
)
|
||||
);
|
||||
?>
|
||||
47
modules/Schedulers/index.php
Executable file
47
modules/Schedulers/index.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
********************************************************************************/
|
||||
//TODO admins only - unless we specify otherwise?
|
||||
if(!$current_user->is_admin) {
|
||||
sugar_die('You must have administrative access to proceed.');
|
||||
}
|
||||
echo get_module_title($mod_strings['LBL_MODULE_TITLE'], $mod_strings['LBL_MODULE_TITLE'], true);
|
||||
require_once('modules/Schedulers/ListView.php');
|
||||
?>
|
||||
155
modules/Schedulers/language/en_us.lang.php
Executable file
155
modules/Schedulers/language/en_us.lang.php
Executable file
@@ -0,0 +1,155 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
global $sugar_config;
|
||||
|
||||
$mod_strings = array (
|
||||
// OOTB Scheduler Job Names:
|
||||
'LBL_OOTB_WORKFLOW' => 'Process Workflow Tasks',
|
||||
'LBL_OOTB_REPORTS' => 'Run Report Generation Scheduled Tasks',
|
||||
'LBL_OOTB_IE' => 'Check Inbound Mailboxes',
|
||||
'LBL_OOTB_BOUNCE' => 'Run Nightly Process Bounced Campaign Emails',
|
||||
'LBL_OOTB_CAMPAIGN' => 'Run Nightly Mass Email Campaigns',
|
||||
'LBL_OOTB_PRUNE' => 'Prune Database on 1st of Month',
|
||||
'LBL_OOTB_TRACKER' => 'Prune Tracker Tables',
|
||||
'LBL_UPDATE_TRACKER_SESSIONS' => 'Update tracker_sessions Table',
|
||||
'LBL_CHECKTEMPRESERVATIONS' => 'checkTempReservations',
|
||||
|
||||
// List Labels
|
||||
'LBL_LIST_JOB_INTERVAL' => 'Interval:',
|
||||
'LBL_LIST_LIST_ORDER' => 'Schedulers:',
|
||||
'LBL_LIST_NAME' => 'Scheduler:',
|
||||
'LBL_LIST_RANGE' => 'Range:',
|
||||
'LBL_LIST_REMOVE' => 'Remove:',
|
||||
'LBL_LIST_STATUS' => 'Status:',
|
||||
'LBL_LIST_TITLE' => 'Schedule List:',
|
||||
'LBL_LIST_EXECUTE_TIME' => 'Will Run At:',
|
||||
// human readable:
|
||||
'LBL_SUN' => 'Sunday',
|
||||
'LBL_MON' => 'Monday',
|
||||
'LBL_TUE' => 'Tuesday',
|
||||
'LBL_WED' => 'Wednesday',
|
||||
'LBL_THU' => 'Thursday',
|
||||
'LBL_FRI' => 'Friday',
|
||||
'LBL_SAT' => 'Saturday',
|
||||
'LBL_ALL' => 'Every Day',
|
||||
'LBL_EVERY_DAY' => 'Every day ',
|
||||
'LBL_AT_THE' => 'At the ',
|
||||
'LBL_EVERY' => 'Every ',
|
||||
'LBL_FROM' => 'From ',
|
||||
'LBL_ON_THE' => 'On the ',
|
||||
'LBL_RANGE' => ' to ',
|
||||
'LBL_AT' => ' at ',
|
||||
'LBL_IN' => ' in ',
|
||||
'LBL_AND' => ' and ',
|
||||
'LBL_MINUTES' => ' minutes ',
|
||||
'LBL_HOUR' => ' hours',
|
||||
'LBL_HOUR_SING' => ' hour',
|
||||
'LBL_MONTH' => ' month',
|
||||
'LBL_OFTEN' => ' As often as possible.',
|
||||
'LBL_MIN_MARK' => ' minute mark',
|
||||
|
||||
|
||||
// crontabs
|
||||
'LBL_MINS' => 'min',
|
||||
'LBL_HOURS' => 'hrs',
|
||||
'LBL_DAY_OF_MONTH' => 'date',
|
||||
'LBL_MONTHS' => 'mo',
|
||||
'LBL_DAY_OF_WEEK' => 'day',
|
||||
'LBL_CRONTAB_EXAMPLES' => 'The above uses standard crontab notation.',
|
||||
// Labels
|
||||
'LBL_ALWAYS' => 'Always',
|
||||
'LBL_CATCH_UP' => 'Execute If Missed',
|
||||
'LBL_CATCH_UP_WARNING' => 'Uncheck if this job may take more than a moment to run.',
|
||||
'LBL_DATE_TIME_END' => 'Date & Time End',
|
||||
'LBL_DATE_TIME_START' => 'Date & Time Start',
|
||||
'LBL_INTERVAL' => 'Interval',
|
||||
'LBL_JOB' => 'Job',
|
||||
'LBL_LAST_RUN' => 'Last Successful Run',
|
||||
'LBL_MODULE_NAME' => 'Sugar Scheduler',
|
||||
'LBL_MODULE_TITLE' => 'Schedulers',
|
||||
'LBL_NAME' => 'Job Name',
|
||||
'LBL_NEVER' => 'Never',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Schedule',
|
||||
'LBL_PERENNIAL' => 'perpetual',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Scheduler Search',
|
||||
'LBL_SCHEDULER' => 'Scheduler:',
|
||||
'LBL_STATUS' => 'Status',
|
||||
'LBL_TIME_FROM' => 'Active From',
|
||||
'LBL_TIME_TO' => 'Active To',
|
||||
'LBL_WARN_CURL_TITLE' => 'cURL Warning:',
|
||||
'LBL_WARN_CURL' => 'Warning:',
|
||||
'LBL_WARN_NO_CURL' => 'This system does not have the cURL libraries enabled/compiled into the PHP module (--with-curl=/path/to/curl_library). Please contact your administrator to resolve this issue. Without the cURL functionality, the Scheduler cannot thread its jobs.',
|
||||
'LBL_BASIC_OPTIONS' => 'Basic Setup',
|
||||
'LBL_ADV_OPTIONS' => 'Advanced Options',
|
||||
'LBL_TOGGLE_ADV' => 'Show Advanced Options',
|
||||
'LBL_TOGGLE_BASIC' => 'Show Basic Options',
|
||||
// Links
|
||||
'LNK_LIST_SCHEDULER' => 'Schedulers',
|
||||
'LNK_NEW_SCHEDULER' => 'Create Scheduler',
|
||||
'LNK_LIST_SCHEDULED' => 'Scheduled Jobs',
|
||||
// Messages
|
||||
'SOCK_GREETING' => "\nThis is the interface for SugarCRM Schedulers Service. \n[ Available daemon commands: start|restart|shutdown|status ]\nTo quit, type 'quit'. To shutdown the service 'shutdown'.\n",
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number to delete the schedule.',
|
||||
'ERR_CRON_SYNTAX' => 'Invalid Cron syntax',
|
||||
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to delete this record?',
|
||||
'NTC_STATUS' => 'Set status to Inactive to remove this schedule from the Scheduler dropdown lists',
|
||||
'NTC_LIST_ORDER' => 'Set the order this schedule will appear in the Scheduler dropdown lists',
|
||||
'LBL_CRON_INSTRUCTIONS_WINDOWS' => 'To Setup Windows Scheduler',
|
||||
'LBL_CRON_INSTRUCTIONS_LINUX' => 'To Setup Crontab',
|
||||
'LBL_CRON_LINUX_DESC' => 'Note: In order to run Sugar Schedulers, add the following line to the crontab file: ',
|
||||
'LBL_CRON_WINDOWS_DESC' => 'Note: In order to run the Sugar schedulers, create a batch file to run using Windows Scheduled Tasks. The batch file should include the following commands: ',
|
||||
'LBL_NO_PHP_CLI' => 'If your host does not have the PHP binary available, you can use wget or curl to launch your Jobs.<br>for wget: <b>* * * * * wget --quiet --non-verbose '.$sugar_config['site_url'].'/cron.php > /dev/null 2>&1</b><br>for curl: <b>* * * * * curl --silent '.$sugar_config['site_url'].'/cron.php > /dev/null 2>&1',
|
||||
// Subpanels
|
||||
'LBL_JOBS_SUBPANEL_TITLE' => 'Job Log',
|
||||
'LBL_EXECUTE_TIME' => 'Execute Time',
|
||||
|
||||
//jobstrings
|
||||
'LBL_REFRESHJOBS' => 'Refresh Jobs',
|
||||
'LBL_POLLMONITOREDINBOXES' => 'Check Inbound Mail Accounts',
|
||||
'LBL_RUNMASSEMAILCAMPAIGN' => 'Run Nightly Mass Email Campaigns',
|
||||
'LBL_POLLMONITOREDINBOXESFORBOUNCEDCAMPAIGNEMAILS' => 'Run Nightly Process Bounced Campaign Emails',
|
||||
'LBL_PRUNEDATABASE' => 'Prune Database on 1st of Month',
|
||||
'LBL_TRIMTRACKER' => 'Prune Tracker Tables',
|
||||
);
|
||||
?>
|
||||
166
modules/Schedulers/language/pl_pl.lang.php
Executable file
166
modules/Schedulers/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version
|
||||
* 1.1.3 ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
* pl_pl.lang.php,v for SugarCRM 4.5-->>
|
||||
* Translator: Krzysztof Morawski
|
||||
* All Rights Reserved.
|
||||
* Any bugs report welcome: krzysiek<at>mojsklepik<dot>net
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
global $sugar_config;
|
||||
|
||||
$mod_strings = array (
|
||||
// OOTB Scheduler Job Names:
|
||||
'LBL_OOTB_WORKFLOW' => 'Przeprowadź prace do wykonania',
|
||||
'LBL_OOTB_REPORTS' => 'wykonaj raport z wykonania zaplanowanych zadań',
|
||||
'LBL_OOTB_IE' => 'Sprawdź skrzynki poczty przychodzącej',
|
||||
'LBL_OOTB_BOUNCE' => 'Wykonaj nocną wysyłkę odbitej poczty kampanii',
|
||||
'LBL_OOTB_CAMPAIGN' => 'Wykonaj nocną masową wysyłkę poczty kampanii',
|
||||
'LBL_OOTB_PRUNE' => 'Oczyść bazę danych 1-go dnia miesiąca',
|
||||
'LBL_OOTB_TRACKER' => 'Oczyść tabele sesji śledzenia',
|
||||
'LBL_UPDATE_TRACKER_SESSIONS' => 'Uaktualnij tabele sesji śledzenia',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// List Labels
|
||||
'LBL_LIST_JOB_INTERVAL' => 'Interwał:',
|
||||
'LBL_LIST_LIST_ORDER' => 'Harmonogramy:',
|
||||
'LBL_LIST_NAME' => 'Harmonogram:',
|
||||
'LBL_LIST_RANGE' => 'Zakres:',
|
||||
'LBL_LIST_REMOVE' => 'Usuń:',
|
||||
'LBL_LIST_STATUS' => 'Status:',
|
||||
'LBL_LIST_TITLE' => 'Lista harmonogramów:',
|
||||
'LBL_LIST_EXECUTE_TIME' => 'Rozpocznie się o:',
|
||||
// human readable:
|
||||
'LBL_SUN' => 'Niedziela',
|
||||
'LBL_MON' => 'Poniedziałek',
|
||||
'LBL_TUE' => 'Wtorek',
|
||||
'LBL_WED' => 'Środa',
|
||||
'LBL_THU' => 'Czwartek',
|
||||
'LBL_FRI' => 'Piątek',
|
||||
'LBL_SAT' => 'Sobota',
|
||||
'LBL_ALL' => 'Każdego dnia',
|
||||
'LBL_EVERY_DAY' => 'Każdego dnia ',
|
||||
'LBL_AT_THE' => 'O ',
|
||||
'LBL_EVERY' => 'Każdego ',
|
||||
'LBL_FROM' => 'Od ',
|
||||
'LBL_ON_THE' => 'Co ',
|
||||
'LBL_RANGE' => ' do ',
|
||||
'LBL_AT' => ' o ',
|
||||
'LBL_IN' => ' w ',
|
||||
'LBL_AND' => ' i ',
|
||||
'LBL_MINUTES' => ' minut ',
|
||||
'LBL_HOUR' => ' godzin',
|
||||
'LBL_HOUR_SING' => ' godzina',
|
||||
'LBL_MONTH' => ' miesiąc',
|
||||
'LBL_OFTEN' => ' Tak często, jak tylko możliwe.',
|
||||
'LBL_MIN_MARK' => ' minut',
|
||||
|
||||
|
||||
// crontabs
|
||||
'LBL_MINS' => 'minuty',
|
||||
'LBL_HOURS' => 'godziny',
|
||||
'LBL_DAY_OF_MONTH' => 'dzień miesiąca',
|
||||
'LBL_MONTHS' => 'miesiąc',
|
||||
'LBL_DAY_OF_WEEK' => 'dzień tygodnia',
|
||||
'LBL_CRONTAB_EXAMPLES' => 'Powyżej użyto notacji crontaba.',
|
||||
// Labels
|
||||
'LBL_ALWAYS' => 'Zawsze',
|
||||
'LBL_CATCH_UP' => 'Przeprowadź, jeżeli przegapiono',
|
||||
'LBL_CATCH_UP_WARNING' => 'Odznacz, jeżeli to działanie ma potrwać dłuzej.',
|
||||
'LBL_DATE_TIME_END' => 'Data i czas zakończenia',
|
||||
'LBL_DATE_TIME_START' => 'Data i czas rozpoczęcia',
|
||||
'LBL_INTERVAL' => 'Interwał',
|
||||
'LBL_JOB' => 'Praca',
|
||||
'LBL_LAST_RUN' => 'Ostanie wykonanie',
|
||||
'LBL_MODULE_NAME' => 'Harmonogram aplikacji',
|
||||
'LBL_MODULE_TITLE' => 'Harmonogram',
|
||||
'LBL_NAME' => 'Nazwa pracy',
|
||||
'LBL_NEVER' => 'Nigdy',
|
||||
'LBL_NEW_FORM_TITLE' => 'Nowy harmonogram',
|
||||
'LBL_PERENNIAL' => 'bez przerwy',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Szukanie harmonogramu',
|
||||
'LBL_SCHEDULER' => 'Harmonogram:',
|
||||
'LBL_STATUS' => 'Status',
|
||||
'LBL_TIME_FROM' => 'Aktywny od',
|
||||
'LBL_TIME_TO' => 'Aktywny do',
|
||||
'LBL_WARN_CURL_TITLE' => 'Ostrzeżenie cURL:',
|
||||
'LBL_WARN_CURL' => 'Ostrzeżenie:',
|
||||
'LBL_WARN_NO_CURL' => 'Ten system nie posiada bibliotek cURL włączonych lub wkompilowanych w moduł PHP (--with-curl=/path/to/curl_library). Skontaktuj się z Administratorem, aby rozwiązać ten problem. Bez cURL nie można przeprowadzić harmonogramu.',
|
||||
'LBL_BASIC_OPTIONS' => 'Podstawowe ustawienia',
|
||||
'LBL_ADV_OPTIONS' => 'Opcje zaawansowane',
|
||||
'LBL_TOGGLE_ADV' => 'Opcje zaawansowane',
|
||||
'LBL_TOGGLE_BASIC' => 'Podstawowe ustawienia',
|
||||
// Links
|
||||
'LNK_LIST_SCHEDULER' => 'Harmonogramy',
|
||||
'LNK_NEW_SCHEDULER' => 'Utwórz harmonogram',
|
||||
'LNK_LIST_SCHEDULED' => 'Zaplanowane prace',
|
||||
|
||||
|
||||
|
||||
// Messages
|
||||
'SOCK_GREETING' => "\nTo jest interfejs dla serwisu harmonogramów SugarCRM. \n[ Dostępne komendy demona: start|restart|shutdown|status ]\nAby wyjść, wpisz 'quit'. Aby wyłączyc serwis, wpisz 'shutdown'.\n",
|
||||
'ERR_DELETE_RECORD' => 'Musi być podany numer rekordu, aby usunąć ten harmonogram.',
|
||||
'ERR_CRON_SYNTAX' => 'Niewłaściwa składnia Crona',
|
||||
'NTC_DELETE_CONFIRMATION' => 'Czy na pewno chcesz usunąć ten rekord?',
|
||||
'NTC_STATUS' => 'Ustaw status na Nieaktywny, aby usunąć ten harmonogram z listy rozwijalnej harmonogramów',
|
||||
'NTC_LIST_ORDER' => 'Kolejność wykonywania tego Harmonogramu pojawi się na liście rozwijalnej',
|
||||
'LBL_CRON_INSTRUCTIONS_WINDOWS' => 'Aby ustawić Harmonogram Windows',
|
||||
'LBL_CRON_INSTRUCTIONS_LINUX' => 'Aby ustawić Crontab',
|
||||
'LBL_CRON_LINUX_DESC' => 'Dodaj tę listę do crontaba: ',
|
||||
'LBL_CRON_WINDOWS_DESC' => 'Utwórz plik wsadowy zawierający te linię: ',
|
||||
'LBL_NO_PHP_CLI' => 'Jeżeli twój komputer nie ma dostępu do binariów PHP, możesz użyć wget albo curl aby załadować twoje Prace.<br>Dla wget: <b>* * * * * wget --quiet --non-verbose '.$sugar_config['site_url'].'/cron.php > /dev/null 2>&1</b><br>for curl: <b>* * * * * curl --silent '.$sugar_config['site_url'].'/cron.php > /dev/null 2>&1',
|
||||
// Subpanels
|
||||
'LBL_JOBS_SUBPANEL_TITLE' => 'Aktwyne prace',
|
||||
'LBL_EXECUTE_TIME' => 'Czas wykonania',
|
||||
|
||||
'LBL_REFRESHJOBS' => 'Odśwież prace',
|
||||
'LBL_POLLMONITOREDINBOXES' => 'Sprawdź konto wiadomości przychodzących',
|
||||
|
||||
'LBL_RUNMASSEMAILCAMPAIGN' => 'Uruchom w nocy kampanie e-mail',
|
||||
'LBL_POLLMONITOREDINBOXESFORBOUNCEDCAMPAIGNEMAILS' => 'Uruchom w nocy proces przetworzania zwróconych emaili kampanii',
|
||||
|
||||
'LBL_PRUNEDATABASE' => 'Oczyść bazę danych 1-go dnia miesiąca',
|
||||
'LBL_TRIMTRACKER' => 'Oczyść tabele sesji śledzenia',
|
||||
|
||||
|
||||
// _DOM
|
||||
'scheduler_status_dom' =>
|
||||
array (
|
||||
'Active' => 'Aktywny',
|
||||
'Inactive' => 'Nieaktywny',
|
||||
),
|
||||
'scheduler_period_dom' =>
|
||||
array (
|
||||
'min' => 'Minuty',
|
||||
'hour' => 'Godziny',
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
56
modules/Schedulers/metadata/subpaneldefs.php
Executable file
56
modules/Schedulers/metadata/subpaneldefs.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
$layout_defs['Schedulers'] = array(
|
||||
// list of what Subpanels to show in the DetailView
|
||||
'subpanel_setup' => array(
|
||||
'times' => array(
|
||||
'order' => 20,
|
||||
'module' => 'SchedulersJobs',
|
||||
'sort_by' => 'execute_time',
|
||||
'sort_order' => 'desc',
|
||||
'subpanel_name' => 'default',
|
||||
'get_subpanel_data' => 'schedulers_times',
|
||||
'add_subpanel_data' => 'scheduler_id',
|
||||
'title_key' => 'LBL_JOBS_SUBPANEL_TITLE',
|
||||
'top_buttons' => array(
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
58
modules/Schedulers/metadata/subpanels/default.php
Executable file
58
modules/Schedulers/metadata/subpanels/default.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
$subpanel_layout = array(
|
||||
'top_buttons' => array(
|
||||
/*array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'Queues'),*/
|
||||
),
|
||||
'where' => "",
|
||||
|
||||
'fill_in_additional_fields'=>true,
|
||||
'list_fields' => array(
|
||||
/* 'mass_update' => array (
|
||||
|
||||
),
|
||||
*/
|
||||
'id'=>array(
|
||||
// 'widget_class' => 'SubPanelDetailViewLink',
|
||||
'vname' => 'LBL_EXECUTE_TIME',
|
||||
'width' => '20%',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
3896
modules/Schedulers/phpMailer.php
Normal file
3896
modules/Schedulers/phpMailer.php
Normal file
File diff suppressed because it is too large
Load Diff
1182
modules/Schedulers/smtp.php
Normal file
1182
modules/Schedulers/smtp.php
Normal file
File diff suppressed because it is too large
Load Diff
11
modules/Schedulers/test.php
Normal file
11
modules/Schedulers/test.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
require_once 'modules/Schedulers/_AddJobsHere.php';
|
||||
|
||||
|
||||
checkEDISales();
|
||||
250
modules/Schedulers/vardefs.php
Executable file
250
modules/Schedulers/vardefs.php
Executable file
@@ -0,0 +1,250 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
$dictionary['schedulers'] = array('table' => 'schedulers',
|
||||
'fields' => array (
|
||||
'id' => array (
|
||||
'name' => 'id',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'id',
|
||||
'dbType' => 'varchar',
|
||||
'len' => 36,
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
),
|
||||
'deleted' => array (
|
||||
'name' => 'deleted',
|
||||
'vname' => 'LBL_DELETED',
|
||||
'type' => 'bool',
|
||||
'len' => 1,
|
||||
'required' => false,
|
||||
'default' => '0',
|
||||
'reportable' => false,
|
||||
),
|
||||
'date_entered' => array (
|
||||
'name' => 'date_entered',
|
||||
'vname' => 'LBL_DATE_ENTERED',
|
||||
'type' => 'datetime',
|
||||
'required' => true,
|
||||
),
|
||||
'date_modified' => array (
|
||||
'name' => 'date_modified',
|
||||
'vname' => 'LBL_DATE_MODIFIED',
|
||||
'type' => 'datetime',
|
||||
'required' => true,
|
||||
),
|
||||
'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' => 'id',
|
||||
'len' => 36,
|
||||
),
|
||||
'created_by_link' => array (
|
||||
'name' => 'created_by_link',
|
||||
'type' => 'link',
|
||||
'relationship' => 'schedulers_created_by_rel',
|
||||
'vname' => 'LBL_CREATED_BY_USER',
|
||||
'link_type' => 'one',
|
||||
'module' => 'Users',
|
||||
'bean_name' => 'User',
|
||||
'source' => 'non-db',
|
||||
),
|
||||
'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' => 'id',
|
||||
'len' => '36',
|
||||
'reportable' => true,
|
||||
),
|
||||
'modified_user_id_link' => array (
|
||||
'name' => 'modified_user_id_link',
|
||||
'type' => 'link',
|
||||
'relationship' => 'schedulers_modified_user_id_rel',
|
||||
'vname' => 'LBL_MODIFIED_BY_USER',
|
||||
'link_type' => 'one',
|
||||
'module' => 'Users',
|
||||
'bean_name' => 'User',
|
||||
'source' => 'non-db',
|
||||
),
|
||||
'name' => array (
|
||||
'name' => 'name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'varchar',
|
||||
'len' => '255',
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
'importable' => 'required',
|
||||
),
|
||||
'job' => array (
|
||||
'name' => 'job',
|
||||
'vname' => 'LBL_JOB',
|
||||
'type' => 'varchar',
|
||||
'len' => '255',
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
),
|
||||
'date_time_start' => array (
|
||||
'name' => 'date_time_start',
|
||||
'vname' => 'LBL_SCHEDULER_DATE_TIME_START',
|
||||
'type' => 'datetime',
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
),
|
||||
'date_time_end' => array (
|
||||
'name' => 'date_time_end',
|
||||
'vname' => 'LBL_SCHEDULER_DATE_TIME_END',
|
||||
'type' => 'datetime',
|
||||
'reportable' => false,
|
||||
),
|
||||
'job_interval' => array (
|
||||
'name' => 'job_interval',
|
||||
'vname' => 'LBL_INTERVAL',
|
||||
'type' => 'varchar',
|
||||
'len' => '100',
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
),
|
||||
'time_from' => array (
|
||||
'name' => 'time_from',
|
||||
'vname' => 'LBL_TIME_FROM',
|
||||
'type' => 'time',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
),
|
||||
'time_to' => array (
|
||||
'name' => 'time_to',
|
||||
'vname' => 'LBL_TIME_TO',
|
||||
'type' => 'time',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
),
|
||||
'last_run' => array (
|
||||
'name' => 'last_run',
|
||||
'vname' => 'LBL_LAST_RUN',
|
||||
'type' => 'datetime',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
),
|
||||
'status' => array (
|
||||
'name' => 'status',
|
||||
'vname' => 'LBL_STATUS',
|
||||
'type' => 'enum',
|
||||
'options' => 'scheduler_status_dom',
|
||||
'len' => '25',
|
||||
'required' => false,
|
||||
'reportable' => false,
|
||||
'importable' => 'required',
|
||||
),
|
||||
'catch_up' => array (
|
||||
'name' => 'catch_up',
|
||||
'vname' => 'LBL_CATCH_UP',
|
||||
'type' => 'bool',
|
||||
'len' => 1,
|
||||
'required' => false,
|
||||
'default' => '1',
|
||||
'reportable' => false,
|
||||
),
|
||||
'schedulers_times' => array (
|
||||
'name' => 'schedulers_times',
|
||||
'vname' => 'LBL_SCHEDULER_TIMES',
|
||||
'type' => 'link',
|
||||
'relationship' => 'schedulers_jobs_rel',
|
||||
'module' => 'SchedulersJobs',
|
||||
'bean_name' => 'Scheduler',
|
||||
'source' => 'non-db',
|
||||
),
|
||||
|
||||
),
|
||||
'indices' => array (
|
||||
array(
|
||||
'name' =>'schedulerspk',
|
||||
'type' =>'primary',
|
||||
'fields' => array(
|
||||
'id'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' =>'idx_schedule',
|
||||
'type'=>'index',
|
||||
'fields' => array(
|
||||
'date_time_start',
|
||||
'deleted'
|
||||
)
|
||||
),
|
||||
),
|
||||
'relationships' => array (
|
||||
'schedulers_created_by_rel' => array (
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Schedulers',
|
||||
'rhs_table' => 'schedulers',
|
||||
'rhs_key' => 'created_by',
|
||||
'relationship_type' => 'one-to-one'
|
||||
),
|
||||
'schedulers_modified_user_id_rel' => array (
|
||||
'lhs_module' => 'Users',
|
||||
'lhs_table' => 'users',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'Schedulers',
|
||||
'rhs_table' => 'schedulers',
|
||||
'rhs_key' => 'modified_user_id',
|
||||
'relationship_type' => 'one-to-one'
|
||||
),
|
||||
'schedulers_jobs_rel' => array(
|
||||
'lhs_module' => 'Schedulers',
|
||||
'lhs_table' => 'schedulers',
|
||||
'lhs_key' => 'id',
|
||||
'rhs_module' => 'SchedulersJobs',
|
||||
'rhs_table' => 'schedulers_times',
|
||||
'rhs_key' => 'scheduler_id',
|
||||
//'join_table' => 'schedulers_times',
|
||||
'relationship_type' => 'one-to-many',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user