Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developer #261

Merged
merged 7 commits into from
Feb 20, 2015
2 changes: 1 addition & 1 deletion config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
********************************************************************************/
// -ve timestamp before release, +ve timestamp after release.
$patch_version = '20150219';
$YetiForce_current_version = '1.3.34 RC';
$YetiForce_current_version = '1.3.37 RC';
$_SESSION['yetiforce_version'] = $YetiForce_current_version;
105 changes: 103 additions & 2 deletions cron/modules/SalesOrder/RecurringInvoice.service
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ for( $i=0; $i< $noOfSalesOrder; $i++ ) {

$currentRecurringDate = $lastRecurringDate;
$originalDate = $lastRecurringDate;

$origMonth = ltrim( $origMonth, '0' );

if ( strtotime($currentRecurringDate) > strtotime($endPeriod) ) {
continue;
Expand Down Expand Up @@ -239,5 +237,108 @@ function checkAndFixInvoiceDate( $nextRecurringDate, $recurringFrequency, $origi
}
}

// check if it is not Public Holiday
$publicHoliday = Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') );
if ( $publicHoliday ) {
// + days
if ( strpos($recurringFrequency, '+') === 0 && strpos($recurringFrequency, 'day') !== false ) {
do {
$nextRecurringDate->modify( '+1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
// + month
else if ( strpos($recurringFrequency, '+') === 0 && strpos($recurringFrequency, 'month') !== false ) {
$nextBusinessDayTemp = clone $nextRecurringDate;
do {
$nextRecurringDate->modify( '+1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );

// if it went beyond current month
if ( $nextBusinessDayTemp->format('n') != $nextRecurringDate->format('n') ) {
$nextRecurringDate = clone $nextBusinessDayTemp;

do {
$nextRecurringDate->modify( '-1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
}
// + year
else if ( strpos($recurringFrequency, '+') === 0 && strpos($recurringFrequency, 'year') !== false ) {
$nextBusinessDayTemp = clone $nextRecurringDate;
do {
$nextRecurringDate->modify( '+1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );

// if it went beyond current month
if ( $nextBusinessDayTemp->format('y') != $nextRecurringDate->format('y') ) {
$nextRecurringDate = clone $nextBusinessDayTemp;

do {
$nextRecurringDate->modify( '-1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
}
// first day of next month
else if ( $recurringFrequency == 'first day of next month' ) {
do {
$nextRecurringDate->modify( '+1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
// last day of next month
else if ( $recurringFrequency == 'last day of next month' ) {
do {
$nextRecurringDate->modify( '-1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
// first day of +3 months
else if ( $recurringFrequency == 'first day of +3 months' ) {
do {
$nextRecurringDate->modify( '+1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
// last day of +3 months
else if ( $recurringFrequency == 'last day of +3 months' ) {
do {
$nextRecurringDate->modify( '-1 day' );
}
while(
$nextRecurringDate->format('l') == 'Sunday' ||
$nextRecurringDate->format('l') == 'Saturday' ||
Settings_PublicHoliday_Module_Model::checkIfHoliday( $nextRecurringDate->format('Y-m-d') ) );
}
}

return $nextRecurringDate;
}
5 changes: 5 additions & 0 deletions languages/de_de/Settings/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
'VTLIB_LBL_MODULE_MANAGER' => 'Modulmanager',
'Webforms' => 'Webformulare',
'website' => 'Webseite',
'LBL_ADD_CUSTOM_FIELD' => 'Add field',
'LBL_FIELD_NAME' => 'Field name',



//YetiForce
Expand Down Expand Up @@ -287,4 +290,6 @@
'LBL_NO_LOGO_SELECTED' => 'Kein Logo ausgewählt',
'LBL_PREFIX_IN_USE' => 'Präfix im Einsatz',
'LBL_WRONG_IMAGE_TYPE' => 'Nicht unterstütztes Bildformat',
'JS_COLUMN_ADDED' => 'Field added',
'JS_COLUMN_EXIST' => 'Error while adding field',
);
4 changes: 4 additions & 0 deletions languages/en_us/Settings/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@
'VTLIB_LBL_MODULE_MANAGER' => 'Module Manager',
'Webforms' => 'Webforms',
'website' => 'Website',
'LBL_ADD_CUSTOM_FIELD' => 'Add field',
'LBL_FIELD_NAME' => 'Field name',


//YetiForce
Expand Down Expand Up @@ -286,4 +288,6 @@
'LBL_NO_LOGO_SELECTED' => 'No logo selected',
'LBL_PREFIX_IN_USE' => 'Prefix in use',
'LBL_WRONG_IMAGE_TYPE' => 'not supported Image type',
'JS_COLUMN_ADDED' => 'Field added',
'JS_COLUMN_EXIST' => 'Error while adding field',
);
4 changes: 4 additions & 0 deletions languages/pl_pl/Settings/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
'Webforms' => 'Formularze www',
'website' => 'Strona WWW',
'vatid'=>'NIP',
'LBL_ADD_CUSTOM_FIELD' => 'Dodaj pole',
'LBL_FIELD_NAME' => 'Nazwa pola',

//YetiForce
'LBL_LOGS_MANAGEMENT' => 'Logi',
Expand Down Expand Up @@ -286,4 +288,6 @@
'LBL_NO_LOGO_SELECTED' => 'Żadne logo nie zostało zaznaczone',
'LBL_PREFIX_IN_USE' => 'Prefiks w użyciu',
'LBL_WRONG_IMAGE_TYPE' => 'nie wspierany format pliku',
'JS_COLUMN_ADDED' => 'Pole dodane',
'JS_COLUMN_EXIST' => 'Bład przy dodaniu pola',
);
4 changes: 4 additions & 0 deletions languages/pt_br/Settings/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@
'VTLIB_LBL_MODULE_MANAGER' => 'Gerenciador Módulos',
'Webforms' => 'Webforms',
'website' => 'Website',
'LBL_ADD_CUSTOM_FIELD' => 'Add field',
'LBL_FIELD_NAME' => 'Field name',


//YetiForce
Expand Down Expand Up @@ -286,4 +288,6 @@
'LBL_NO_LOGO_SELECTED' => 'Nenhuma logo selecionada',
'LBL_PREFIX_IN_USE' => 'Prefixo em uso',
'LBL_WRONG_IMAGE_TYPE' => 'o tipo de imagem não é suportado',
'JS_COLUMN_ADDED' => 'Field added',
'JS_COLUMN_EXIST' => 'Error while adding field',
);
4 changes: 4 additions & 0 deletions languages/ru_ru/Settings/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
'VTLIB_LBL_MODULE_MANAGER' => 'Менеджер модулей',
'Webforms' => 'Веб-Формы',
'website' => 'Сайт',
'LBL_ADD_CUSTOM_FIELD' => 'Add field',
'LBL_FIELD_NAME' => 'Field name',


//YetiForce
Expand Down Expand Up @@ -302,4 +304,6 @@
'LBL_NO_LOGO_SELECTED' => 'Не выбран логотип',
'LBL_PREFIX_IN_USE' => 'префикс уже используется',
'LBL_WRONG_IMAGE_TYPE' => 'Не поддерживаемый формат изображения',
'JS_COLUMN_ADDED' => 'Field added',
'JS_COLUMN_EXIST' => 'Error while adding field',
);
21 changes: 20 additions & 1 deletion layouts/vlayout/modules/Settings/Vtiger/CompanyDetails.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
<h3>{vtranslate('LBL_COMPANY_DETAILS', $QUALIFIED_MODULE)}</h3>
{if $DESCRIPTION}<span style="font-size:12px;color: black;"> - &nbsp;{vtranslate({$DESCRIPTION}, $QUALIFIED_MODULE)}</span>{/if}
</div>
<div class="span4">
<div class="span3">
<button id="addCustomField" class="btn pull-right" type="button">
<strong>{vtranslate('LBL_ADD_CUSTOM_FIELD', $QUALIFIED_MODULE)}</strong>
</button>
</div>
<div class="span1">

<button id="updateCompanyDetails" class="btn pull-right">{vtranslate('LBL_EDIT',$QUALIFIED_MODULE)}</button>
</div>
</div>
Expand Down Expand Up @@ -102,4 +108,17 @@
{/foreach}
{include file="ModalFooter.tpl"|@vtemplate_path:$QUALIFIED_MODULE}
</form>

<form class="form-horizontal hide" id="addCustomFieldForm" method="post" action="index.php">
<input type="hidden" name="module" value="Vtiger" />
<input type="hidden" name="parent" value="Settings" />
<input type="hidden" name="action" value="SaveCompanyField" />
<div class="control-group">
<div class="control-label">{vtranslate('LBL_FIELD_NAME',$QUALIFIED_MODULE)}</div>
<div class="controls">
<input type="text" name="field name" id="fieldName" />
</div>
</div>
{include file="ModalFooter.tpl"|@vtemplate_path:$QUALIFIED_MODULE}
</form>
{/strip}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,24 @@ jQuery.Class("Settings_Vtiger_CompanyDetails_Js",{},{
jQuery('#updateCompanyDetails').on('click',function(e){
jQuery('#CompanyDetailsContainer').addClass('hide');
jQuery('#updateCompanyDetailsForm').removeClass('hide');
jQuery('#updateCompanyDetails').addClass('hide');
jQuery('#updateCompanyDetails').addClass('hide');
jQuery('#addCustomFieldForm').addClass('hide');
jQuery('#addCustomField').addClass('hide');

});
},

registerAddFieldEvent : function(){
jQuery('#addCustomField').on('click',function(e){
jQuery('#addCustomField').addClass('hide');
jQuery('#CompanyDetailsContainer').addClass('hide');
jQuery('#updateCompanyDetailsForm').addClass('hide');
jQuery('#addCustomFieldForm').removeClass('hide');
jQuery('#updateCompanyDetails').addClass('hide');
jQuery('#addCustomField').addClass('hide');
});

},

registerSaveCompanyDetailsEvent : function() {
var thisInstance = this;
Expand All @@ -30,9 +45,12 @@ jQuery.Class("Settings_Vtiger_CompanyDetails_Js",{},{

registerCancelClickEvent : function () {
jQuery('.cancelLink').on('click',function() {
jQuery('#addCustomField').removeClass('hide');
jQuery('#CompanyDetailsContainer').removeClass('hide');
jQuery('#updateCompanyDetailsForm').addClass('hide');
jQuery('#updateCompanyDetails').removeClass('hide');
jQuery('#addCustomFieldForm').removeClass('hide');
jQuery('#addCustomFieldForm').addClass('hide');
});
},

Expand Down Expand Up @@ -66,8 +84,28 @@ jQuery.Class("Settings_Vtiger_CompanyDetails_Js",{},{

}
},

isFieldAdded : function(){
var isParamExist = this.getParameterByName('AddField');
if(0 == isParamExist && isParamExist != ''){
var param = {text:app.vtranslate('JS_COLUMN_EXIST')};
Vtiger_Helper_Js.showPnotify(param);
}
if(1 == isParamExist){
var param = {text:app.vtranslate('JS_COLUMN_ADDED')};
Vtiger_Helper_Js.showMessage(param);
}
},

getParameterByName : function(name){
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
},

registerEvents: function() {
this.registerAddFieldEvent();
this.registerUpdateDetailsClickEvent();
this.registerSaveCompanyDetailsEvent();
this.registerCancelClickEvent();
Expand All @@ -79,4 +117,5 @@ jQuery.Class("Settings_Vtiger_CompanyDetails_Js",{},{
jQuery(document).ready(function(e){
var instance = new Settings_Vtiger_CompanyDetails_Js();
instance.registerEvents();
instance.isFieldAdded();
})
17 changes: 17 additions & 0 deletions modules/OSSEmployees/dashboards/TimeControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
*************************************************************************************************************************************/
class OSSEmployees_TimeControl_Dashboard extends Vtiger_IndexAjax_View {

function getSearchParams($assignedto = '',$date) {
$conditions = array();
$listSearchParams = array();
if($assignedto != '') array_push($conditions,array('assigned_user_id','e',getUserFullName($assignedto)));
if(!empty($date)){
array_push($conditions,array('due_date','bw',$date.','.$date.''));
}
$listSearchParams[] = $conditions;
return '&search_params='. json_encode($listSearchParams);
}

public function process(Vtiger_Request $request) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$loggedUserId = $currentUser->get('id');
Expand All @@ -36,6 +47,12 @@ public function process(Vtiger_Request $request) {
$data = $moduleModel->getWidgetTimeControl($user, $time);
$workDays = $moduleModel->getWorkingDays($time['start'], $time['end']);
$selectedDays = (strtotime($time['end']) - strtotime($time['start'])) / (60*60*24) + 1;

$listViewUrl = 'index.php?module=OSSTimeControl&view=List';
for($i = 0;$i<count($data['data']);$i++){
$data['data'][$i]["links"] = $listViewUrl.$this->getSearchParams($user,$data['data'][$i][1]);
}


$viewer->assign('SELECTEDDAYS', $selectedDays);
$viewer->assign('WORKDAYS', $workDays);
Expand Down
24 changes: 24 additions & 0 deletions modules/Settings/PublicHoliday/models/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,28 @@ public static function edit( $id, $date, $name ) {
else
return false;
}

/**
* Check if it is public holiday
* @param <String> $date - date to be checked
* @return - true if public holiday exists, false on failure
*/
public static function checkIfHoliday( $date ) {
global $log;
$log->debug("Entering Settings_PublicHoliday_Module_Model::checkIfHoliday(".$date.") method ...");

$db = PearDatabase::getInstance();
$sql = 'SELECT COUNT(1) as num FROM `vtiger_publicholiday` WHERE `holidaydate` = ?;';
$params = array( $date );

$result = $db->pquery( $sql, $params );
$num = $db->query_result( $result, 0, 'num' );

$log->debug("Exiting Settings_PublicHoliday_Module_Model::checkIfHoliday() method ...");

if ( $num > 0 )
return true;

return false;
}
}
Loading