Compare commits

...

4 Commits

Author SHA1 Message Date
gamonoid
86c572bdd1 Fix code style issues 2018-03-18 06:46:00 +01:00
gamonoid
a0db9da5f4 Fix unit tests 2018-03-18 06:46:00 +01:00
gamonoid
afc069afaa Translation updates and UI improvements 2018-03-18 06:46:00 +01:00
Patrick Geselbracht
a0d77cb944 Updates German translations (#97)
* Update of German translations up until line 1210

* Translates the rest of the German po file

* Changes last translator line at beginning of file

* Fixes two strings that sounded weird in context
2018-03-18 06:46:00 +01:00
39 changed files with 11668 additions and 14715 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -22,263 +22,259 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin
ValidationRules = {
float: function (str) {
var floatstr = /^[-+]?[0-9]+(\.[0-9]+)?$/;
if (str != null && str.match(floatstr)) {
return true;
} else {
return false;
}
},
float: function (str) {
var floatstr = /^[-+]?[0-9]+(\.[0-9]+)?$/;
if (str != null && str.match(floatstr)) {
return true;
} else {
return false;
}
},
number: function (str) {
var numstr = /^[0-9]+$/;
if (str != null && str.match(numstr)) {
return true;
} else {
return false;
}
},
number: function (str) {
var numstr = /^[0-9]+$/;
if (str != null && str.match(numstr)) {
return true;
} else {
return false;
}
},
numberOrEmpty: function (str) {
if(str == ""){
return true;
}
var numstr = /^[0-9]+$/;
if (str != null && str.match(numstr)) {
return true;
} else {
return false;
}
},
numberOrEmpty: function (str) {
if(str == ""){
return true;
}
var numstr = /^[0-9]+$/;
if (str != null && str.match(numstr)) {
return true;
} else {
return false;
}
},
email: function (str) {
var emailPattern = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
return str != null && emailPattern.test(str);
},
email: function (str) {
var emailPattern = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
return str != null && emailPattern.test(str);
},
emailOrEmpty: function (str) {
if(str == ""){
return true;
}
var emailPattern = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
return str != null && emailPattern.test(str);
},
emailOrEmpty: function (str) {
if(str == ""){
return true;
}
var emailPattern = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
return str != null && emailPattern.test(str);
},
username: function (str) {
var username = /^[a-zA-Z0-9\.-]+$/;
return str != null && username.test(str);
},
username: function (str) {
var username = /^[a-zA-Z0-9\.-]+$/;
return str != null && username.test(str);
},
input: function (str) {
if (str != null && str.length > 0) {
return true;
} else {
return false;
}
}
input: function (str) {
if (str != null && str.length > 0) {
return true;
} else {
return false;
}
}
};
function FormValidation(formId,validateAll,options) {
this.tempOptions = {};
this.formId = formId;
this.formError = false;
this.formObject = null;
this.errorMessages = "";
this.popupDialog = null;
this.validateAll = validateAll;
this.errorMap = new Array();
this.tempOptions = {};
this.formId = formId;
this.formError = false;
this.formObject = null;
this.errorMessages = "";
this.popupDialog = null;
this.validateAll = validateAll;
this.errorMap = new Array();
this.settings = {"thirdPartyPopup":null,"LabelErrorClass":false, "ShowPopup":true};
this.settings = {"thirdPartyPopup":null,"LabelErrorClass":false, "ShowPopup":true};
this.settings = jQuery.extend(this.settings,options);
this.settings = jQuery.extend(this.settings,options);
this.inputTypes = new Array( "text", "radio", "checkbox", "file", "password", "select-one","select-multi", "textarea","fileupload" ,"signature");
this.inputTypes = new Array( "text", "radio", "checkbox", "file", "password", "select-one","select-multi", "textarea","fileupload" ,"signature");
this.validator = ValidationRules;
this.validator = ValidationRules;
}
FormValidation.method('clearError' , function(formInput, overrideMessage) {
var id = formInput.attr("id");
$('#'+ this.formId +' #field_'+id).removeClass('error');
$('#'+ this.formId +' #help_'+id).html('');
var id = formInput.attr("id");
$('#'+ this.formId +' #field_'+id).removeClass('error');
$('#'+ this.formId +' #help_'+id).html('');
});
FormValidation.method('addError' , function(formInput, overrideMessage) {
this.formError = true;
if(formInput.attr("message") != null) {
this.errorMessages += (formInput.attr("message") + "\n");
this.errorMap[formInput.attr("name")] = formInput.attr("message");
}else{
this.errorMap[formInput.attr("name")] = "";
}
this.formError = true;
if(formInput.attr("message") != null) {
this.errorMessages += (formInput.attr("message") + "\n");
this.errorMap[formInput.attr("name")] = formInput.attr("message");
}else{
this.errorMap[formInput.attr("name")] = "";
}
var id = formInput.attr("id");
var validation = formInput.attr("validation");
var message = formInput.attr("validation");
$('#'+ this.formId +' #field_'+id).addClass('error');
if(message == undefined || message == null || message == ""){
$('#'+ this.formId +' #help_'+id).html(message);
}else{
if(validation == undefined || validation == null || validation == ""){
$('#'+ this.formId +' #help_'+id).html("Required");
}else{
if(validation == "float" || validation == "number"){
$('#'+ this.formId +' #help_'+id).html("Number required");
}else if(validation == "email"){
$('#'+ this.formId +' #help_'+id).html("Email required");
}else{
$('#'+ this.formId +' #help_'+id).html("Required");
}
}
}
var id = formInput.attr("id");
var validation = formInput.attr("validation");
var message = formInput.attr("validation");
$('#'+ this.formId +' #field_'+id).addClass('error');
if(message == undefined || message == null || message == ""){
$('#'+ this.formId +' #help_err_'+id).html(message);
}else{
if(validation == undefined || validation == null || validation == ""){
$('#'+ this.formId +' #help_err_'+id).html("Required");
}else{
if(validation == "float" || validation == "number"){
$('#'+ this.formId +' #help_err_'+id).html("Number required");
}else if(validation == "email"){
$('#'+ this.formId +' #help_err_'+id).html("Email required");
}else{
$('#'+ this.formId +' #help_err_'+id).html("Required");
}
}
}
});
FormValidation.method('showErrors' , function() {
if(this.formError) {
if(this.settings['thirdPartyPopup'] != undefined && this.settings['thirdPartyPopup'] != null){
this.settings['thirdPartyPopup'].alert();
}else{
if(this.settings['ShowPopup'] == true){
if(this.tempOptions['popupTop'] != undefined && this.tempOptions['popupTop'] != null){
this.alert("Errors Found",this.errorMessages,this.tempOptions['popupTop']);
}else{
this.alert("Errors Found",this.errorMessages,-1);
}
if(this.formError) {
if(this.settings['thirdPartyPopup'] != undefined && this.settings['thirdPartyPopup'] != null){
this.settings['thirdPartyPopup'].alert();
}else{
if(this.settings['ShowPopup'] == true){
if(this.tempOptions['popupTop'] != undefined && this.tempOptions['popupTop'] != null){
this.alert("Errors Found",this.errorMessages,this.tempOptions['popupTop']);
}else{
this.alert("Errors Found",this.errorMessages,-1);
}
}
}
}
}
}
});
FormValidation.method('checkValues' , function(options) {
this.tempOptions = options;
var that = this;
this.formError = false;
this.errorMessages = "";
this.formObject = new Object();
var validate = function (inputObject) {
if(that.settings['LabelErrorClass'] != false){
$("label[for='" + name + "']").removeClass(that.settings['LabelErrorClass']);
}
var id = inputObject.attr("id");
var name = inputObject.attr("name");
var type = inputObject.attr("type");
this.tempOptions = options;
var that = this;
this.formError = false;
this.errorMessages = "";
this.formObject = new Object();
var validate = function (inputObject) {
if(that.settings['LabelErrorClass'] != false){
$("label[for='" + name + "']").removeClass(that.settings['LabelErrorClass']);
}
var id = inputObject.attr("id");
var name = inputObject.attr("name");
var type = inputObject.attr("type");
if(inputObject.hasClass('select2-focusser') || inputObject.hasClass('select2-input')){
return true;
}
if(inputObject.hasClass('select2-focusser') || inputObject.hasClass('select2-input')){
return true;
}
if(jQuery.inArray(type, that.inputTypes ) >= 0) {
if(inputObject.hasClass('uploadInput')){
inputValue = inputObject.attr("val");
//}else if(inputObject.hasClass('datetimeInput')){
//inputValue = inputObject.getDate()+":00";
}else{
//inputValue = (type == "radio" || type == "checkbox")?$("input[name='" + name + "']:checked").val():inputObject.val();
if(jQuery.inArray(type, that.inputTypes ) >= 0) {
if(inputObject.hasClass('uploadInput')){
inputValue = inputObject.attr("val");
//}else if(inputObject.hasClass('datetimeInput')){
//inputValue = inputObject.getDate()+":00";
}else{
//inputValue = (type == "radio" || type == "checkbox")?$("input[name='" + name + "']:checked").val():inputObject.val();
inputValue = null;
if(type == "radio" || type == "checkbox"){
inputValue = $("input[name='" + name + "']:checked").val();
}else if(inputObject.hasClass('select2Field')){
if($('#'+id).select2('data') != null && $('#'+id).select2('data') != undefined){
inputValue = $('#'+id).select2('data').id;
}else{
inputValue = "";
}
inputValue = null;
if(type == "radio" || type == "checkbox"){
inputValue = $("input[name='" + name + "']:checked").val();
}else if(inputObject.hasClass('select2Field')){
if($('#'+id).select2('data') != null && $('#'+id).select2('data') != undefined){
inputValue = $('#'+id).select2('data').id;
}else{
inputValue = "";
}
}else if(inputObject.hasClass('select2Multi')){
if($('#'+id).select2('data') != null && $('#'+id).select2('data') != undefined){
inputValueObjects = $('#'+id).select2('data');
inputValue = [];
for(var i=0;i<inputValueObjects.length;i++){
inputValue.push(inputValueObjects[i].id);
}
inputValue = JSON.stringify(inputValue);
}else{
inputValue = "";
}
}else if(inputObject.hasClass('select2Multi')){
if($('#'+id).select2('data') != null && $('#'+id).select2('data') != undefined){
inputValueObjects = $('#'+id).select2('data');
inputValue = [];
for(var i=0;i<inputValueObjects.length;i++){
inputValue.push(inputValueObjects[i].id);
}
inputValue = JSON.stringify(inputValue);
}else{
inputValue = "";
}
}else if(inputObject.hasClass('signatureField')){
if($('#'+id).data('signaturePad').isEmpty()){
inputValue = '';
}else{
inputValue = $('#'+id).data('signaturePad').toDataURL();
}
}else if(inputObject.hasClass('simplemde')){
inputValue = $('#'+id).data('simplemde').value();
}else if(inputObject.hasClass('simplemde')){
inputValue = $('#'+id).data('simplemde').value();
}else if(inputObject.hasClass('tinymce')){
inputValue = tinyMCE.get(id).getContent({format : 'raw'});
}else if(inputObject.hasClass('tinymce')){
inputValue = tinyMCE.get(id).getContent({format : 'raw'});
}else{
inputValue = inputObject.val();
}
}
inputValue = inputObject.val();
}
}
var validation = inputObject.attr('validation');
var valid = false;
var validation = inputObject.attr('validation');
var valid = false;
if(validation != undefined && validation != null && that.validator[validation] != undefined && that.validator[validation] != null){
valid = that.validator[validation](inputValue);
if(validation != undefined && validation != null && that.validator[validation] != undefined && that.validator[validation] != null){
valid = that.validator[validation](inputValue);
}else{
}else{
if(that.validateAll){
if(validation != undefined && validation != null && validation == "none"){
valid = true;
}else{
valid = that.validator['input'](inputValue);
}
if(that.validateAll){
if(validation != undefined && validation != null && validation == "none"){
valid = true;
}else{
valid = that.validator['input'](inputValue);
}
}else{
valid = true;
}
$(that.formObject).attr(id,inputValue);
}
}else{
valid = true;
}
$(that.formObject).attr(id,inputValue);
}
if(!valid) {
that.addError(inputObject, null);
}else{
that.clearError(inputObject, null);
$(that.formObject).attr(id,inputValue);
}
}
if(!valid) {
that.addError(inputObject, null);
}else{
that.clearError(inputObject, null);
$(that.formObject).attr(id,inputValue);
}
}
};
};
var inputs = $('#'+ this.formId + " :input");
var inputs = $('#'+ this.formId + " :input");
inputs.each(function() {
var that = $(this);
validate(that);
var that = $(this);
validate(that);
});
inputs = $('#'+ this.formId + " .uploadInput");
inputs.each(function() {
var that = $(this);
validate(that);
var that = $(this);
validate(that);
});
this.showErrors();
this.tempOptions = {};
return !this.formError;
return !this.formError;
});
FormValidation.method('getFormParameters' , function() {
return this.formObject;
return this.formObject;
});
FormValidation.method('alert', function (title,text,top) {
alert(text);
alert(text);
});

View File

@@ -715,3 +715,22 @@ table.dataTable{
.small-box{
box-shadow: 0 2px 5px 0 rgba(0,0,0,.12), 0 2px 10px 0 rgba(0,0,0,.09);
}
.help-info{
font-size: 25px;
color: #367fa9;
padding-top: 4px;
cursor: pointer;
}
.hide {
display: none;
}
.ice-form-error {
font-size: 1em;
}
.ice-form-error-control {
padding-bottom: 1rem;
}

View File

@@ -1,10 +0,0 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: English\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +0,0 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: English\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: English\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: English\n"
msgid "Save"
msgstr "Save"
@@ -1566,9 +1568,6 @@ msgstr "Loans Taken"
msgid "Change Leave Status"
msgstr "Change Leave Status"
msgid "Leave Status"
msgstr "Leave Status"
msgid "Status Change Note"
msgstr "Status Change Note"
@@ -1598,5 +1597,3 @@ msgstr "Apply"
msgid "Back"
msgstr "Back"

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: Spanish\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: Spanish\n"
msgid "Save"
msgstr "Salvar"
@@ -1566,9 +1568,6 @@ msgstr "Los préstamos contraídos"
msgid "Change Leave Status"
msgstr "Dejar cambiar de estado"
msgid "Leave Status"
msgstr "Deja Estado"
msgid "Status Change Note"
msgstr "Cambio de Estado Nota"
@@ -1598,4 +1597,3 @@ msgstr "Aplicar"
msgid "Back"
msgstr "Espalda"

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: French\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: French\n"
msgid "Save"
msgstr "Sauvegarder"
@@ -1566,9 +1568,6 @@ msgstr "Prêts Pris"
msgid "Change Leave Status"
msgstr "Changer congé Status"
msgid "Leave Status"
msgstr "Laissez Status"
msgid "Status Change Note"
msgstr "Changement d'état Remarque"
@@ -1598,4 +1597,3 @@ msgstr "Appliquer"
msgid "Back"
msgstr "Arrière"

1601
lang/hi.po

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: Italian\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: Italian\n"
msgid "Save"
msgstr "Salvare"
@@ -1566,9 +1568,6 @@ msgstr "Prestiti contratti"
msgid "Change Leave Status"
msgstr "Cambiare Leave Stato"
msgid "Leave Status"
msgstr "Lasciare Stato"
msgid "Status Change Note"
msgstr "Modifica stato Nota"
@@ -1598,4 +1597,3 @@ msgstr "Applicare"
msgid "Back"
msgstr "Indietro"

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: Japanese\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: Japanese\n"
msgid "Save"
msgstr "セーブ"
@@ -1566,9 +1568,6 @@ msgstr "借入"
msgid "Change Leave Status"
msgstr "脱退ステータスを変更"
msgid "Leave Status"
msgstr "ステータスを残します"
msgid "Status Change Note"
msgstr "ステータス変更(注)"
@@ -1598,4 +1597,3 @@ msgstr "適用します"
msgid "Back"
msgstr "バック"

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: Polish\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: Polish\n"
msgid "Save"
msgstr "Zapisać"
@@ -1566,9 +1568,6 @@ msgstr "Pożyczki zaciągnięte"
msgid "Change Leave Status"
msgstr "Pozostawić zmiany statusu"
msgid "Leave Status"
msgstr "Zostaw status"
msgid "Status Change Note"
msgstr "Zmiana stanu Uwaga"
@@ -1598,4 +1597,3 @@ msgstr "Zastosować"
msgid "Back"
msgstr "Plecy"

1601
lang/si.po

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,15 @@
msgid ""
msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: Chinese\n"
"Language-Team: IceHrm\n"
"Last-Translator: Thilina Hasantha\n"
"MIME-Version: 1.0\n"
"Project-Id-Version: 18.0\n"
"Report-Msgid-Bugs-To: https://icehrm.com\n"
"Last-Translator: Thilina Hasantha\n"
"Language-Team: IceHrm\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-03-05T05:26:33+05:30\n"
"PO-Revision-Date: 2018-03-05T05:26:33+05:30\n"
"Language: Chinese\n"
msgid "Save"
msgstr "保存"
@@ -1566,9 +1568,6 @@ msgstr "采取贷款"
msgid "Change Leave Status"
msgstr "更改休假状态"
msgid "Leave Status"
msgstr "离开状态"
msgid "Status Change Note"
msgstr "状态更改注"
@@ -1598,4 +1597,3 @@ msgstr "应用"
msgid "Back"
msgstr "背部"

View File

@@ -1,5 +1,6 @@
<?php
$migrationList = [];
$migrationList[] = 'v20180305_210100_drop_si_hi_languages';
$migrationList[] = 'v20171126_200303_swift_mail';
$migrationList[] = 'v20171003_200302_payroll_meta_export';
$migrationList[] = 'v20171003_200301_add_deduction_group_payroll';

View File

@@ -0,0 +1,35 @@
<?php
namespace Classes\Migration;
use Metadata\Common\Model\SupportedLanguage;
class v20180305_210100_drop_si_hi_languages extends AbstractMigration{
public function up(){
$supportedLanguage = new SupportedLanguage();
$supportedLanguage->Load('name = ?', array('si'));
$supportedLanguage->Delete();
$supportedLanguage = new SupportedLanguage();
$supportedLanguage->Load('name = ?', array('hi'));
$supportedLanguage->Delete();
return true;
}
public function down(){
$supportedLanguage = new SupportedLanguage();
$supportedLanguage->name = 'si';
$supportedLanguage->description = 'Sinhala';
$supportedLanguage->Save();
$supportedLanguage = new SupportedLanguage();
$supportedLanguage->name = 'hi';
$supportedLanguage->description = 'Hindi';
$supportedLanguage->Save();
return true;
}
}

View File

@@ -22,6 +22,59 @@ class RoboFile extends \Robo\Tasks
$this->say("Hello, " . implode(', ', $world));
}
function languageList($client) {
$this->includeCientConfig($client);
$this->say("Supported Languages for ". $client);
$language = new \Metadata\Common\Model\SupportedLanguage();
$langs = $language->Find('1 = 1');
$this->say(print_r(array_column($langs, 'name'), true));
}
function languageExport($client) {
$this->includeCientConfig($client);
$language = new \Metadata\Common\Model\SupportedLanguage();
$languages = $language->Find('1 = 1 order by id');
$data = [];
$data[0] = [];
$data[0][] = 'Key';
foreach ($languages as $lang) {
$data[0][] = $lang->name;
$trans = \Classes\LanguageManager::getTranslations($lang->name);
$trans = json_decode($trans, true)['messages'][''];
$count = 1;
foreach ($trans as $enVal => $langVal) {
if (!isset($data[$count])) {
$data[$count] = [];
$data[$count][] = $enVal;
}
$data[$count][] = $langVal[0];
$count += 1;
}
}
$fp = fopen(CLIENT_BASE_PATH.'data/translations.csv', 'w');
foreach ($data as $fields) {
fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF));
fputcsv($fp, $fields);
}
fclose($fp);
$this->say('File saved');
}
function languageImport($client, $file) {
$this->includeCientConfig($client);
$language = new \Metadata\Common\Model\SupportedLanguage();
$languages = $language->Find('1 = 1 order by id');
foreach ($languages as $language) {
$str = $this->getUpdatedTranslationString($language->name, $file);
file_put_contents(
__DIR__.'/../lang/'.$language->name.'.po',
$str);
$this->say('Updated :'.realpath(__DIR__.'/../lang/'.$language->name.'.po'));
}
}
function migrate($client, $action){
$this->includeCientConfig($client);
$this->say("DB Migrating " . $action . " for ". $client);
@@ -50,4 +103,44 @@ class RoboFile extends \Robo\Tasks
}
$this->say("DB Migration Completed !!!");
}
/**
* @param $lang
* @param $file
* @return mixed
*/
protected function getUpdatedTranslationString($lang, $file)
{
$handle = fopen(CLIENT_BASE_PATH . 'data/' . $file, "r");
$langColumn = null;
/* @var \Gettext\Translations $trans */
$trans = \Classes\LanguageManager::getTranslationsObject($lang);
while (($data = fgetcsv($handle)) !== FALSE) {
if ($langColumn === null) {
$currentColumn = 0;
foreach ($data as $language) {
if ($language === $lang) {
$langColumn = $currentColumn;
break;
}
$currentColumn++;
}
if ($langColumn === null) {
$this->say('Invalid Language');
exit();
}
} else {
/* @var \Gettext\Translation $tran */
$tran = $trans->find('', $data[0]);
if ($tran !== false) {
$tran->setTranslation($data[$langColumn]);
} else {
$trans->insert($data[0], $data[$langColumn]);
}
}
}
return $trans->toPoString();
}
}

View File

@@ -9,40 +9,45 @@ use Utils\LogManager;
class LanguageManager
{
private static $me = null;
private static $me = [];
/* @var \Gettext\Translator $translator */
private $translator = null;
/* @var \Gettext\Translations $translations */
private $translations = null;
private function __construct()
{
}
private static function getInstance()
private static function getInstance($lang = null)
{
if (empty(self::$me)) {
self::$me = new LanguageManager();
self::$me->loadLanguage();
if ($lang === null) {
$lang = self::getCurrentLang();
}
if (empty(self::$me[$lang])) {
self::$me[$lang] = new LanguageManager();
self::$me[$lang]->initialize($lang);
}
return self::$me;
return self::$me[$lang];
}
private function loadLanguage()
private function initialize($lang)
{
$this->loadLanguage($lang);
}
public function loadLanguage($lang)
{
$lang = $this->getCurrentLang();
$this->translations = Translations::fromPoFile(APP_BASE_PATH.'lang/'.$lang.'.po');
if (file_exists(APP_BASE_PATH.'lang/'.$lang.'-ext.po')) {
$this->translations->addFromPoFile(APP_BASE_PATH.'lang/'.$lang.'-ext.po');
}
$t = new Translator();
$t->loadTranslations($this->translations);
$t->register();
$this->translator = $t;
}
private function getCurrentLang()
private static function getCurrentLang()
{
$user = BaseService::getInstance()->getCurrentUser();
if (empty($user) || empty($user->lang) || $user->lang == "NULL") {
@@ -56,16 +61,21 @@ class LanguageManager
if (empty($lang) || !file_exists(APP_BASE_PATH.'lang/'.$lang.'.po')) {
$lang = 'en';
}
LogManager::getInstance()->info("Current Language:".$lang);
return $lang;
}
public static function getTranslations()
public static function getTranslations($lang = null)
{
$me = self::getInstance();
$me = self::getInstance($lang);
return Json::toString($me->translations);
}
public static function getTranslationsObject($lang = null)
{
$me = self::getInstance($lang);
return $me->translations;
}
public static function tran($text)
{
$me = self::getInstance();

View File

@@ -7,6 +7,8 @@
</div>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -9,6 +9,8 @@
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -8,6 +8,8 @@
</div>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -10,6 +10,8 @@
</div>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -7,6 +7,8 @@
<button id="_id__remove" onclick="$('#_id_').attr('val','');return false;" class="btn btn-mini btn-inverse" type="button" style="margin-left:30px;margin-top:3px;"><t>Remove</t></button>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -4,6 +4,8 @@
<input class="control-label" id="_id_"/>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_"></span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -4,6 +4,8 @@
<label id="_id_" name="_id_" style="text-align: left;" class="control-label" _validation_></label>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_"></span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -6,6 +6,8 @@
</select>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -6,6 +6,8 @@
</select>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -6,6 +6,8 @@
</select>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -4,6 +4,8 @@
<canvas class="form-control signatureField" type="signature" id="_id_" name="_id_" _validation_ style="height:120px;"></canvas>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -4,6 +4,8 @@
<textarea class="form-control simplemde" type="textarea" rows="4" id="_id_" name="_id_" _validation_></textarea>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -1,9 +1,11 @@
<div class="row" id="field__id_">
<label class="col-sm-3 control-label" for="_id_">_label_</label>
<div class="controls col-sm-6">
<input class="form-control" type="text" id="_id_" name="_id_" value="" _validation_/>
<input class="form-control" type="text" id="_id_" name="_id_" value="" _validation_ _placeholder_/>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -1,9 +1,11 @@
<div class="row" id="field__id_">
<label class="control-label col-sm-3" for="_id_">_label_</label>
<div class="controls col-sm-6">
<textarea class="form-control" type="textarea" rows="4" id="_id_" name="_id_" _validation_></textarea>
<textarea class="form-control" type="textarea" rows="4" id="_id_" name="_id_" _validation_ _placeholder_></textarea>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -10,6 +10,8 @@
</div>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -4,6 +4,8 @@
<textarea class="form-control tinymce" type="textarea" rows="4" id="_id_" name="_id_" _validation_></textarea>
</div>
<div class="controls col-sm-3">
<span class="help-inline control-label" id="help__id_">_helpline_</span>
<div id="help__id_" class="fa fa-info-circle help-info _hidden_class_help_"
onclick="modJs.showMessage('Tip','_helpline_')"></div>
<span id="help_err__id_"></span>
</div>
</div>

View File

@@ -2,8 +2,8 @@
<form class="form-horizontal" id="_id_" role="form">
<div class="box-body">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="_id__error" style="display:none;"></span>
<div class="controls ice-form-error-control">
<span class="ice-form-error label label-danger" id="_id__error" style="display:none;"></span>
</div>
</div>
_fields_

View File

@@ -1,8 +1,12 @@
<?php
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase{
if (!class_exists('PHPUnit_Framework_TestCase')) {
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase
{
}
}
class TestTemplate extends PHPUnit_Framework_TestCase
{

View File

@@ -1,21 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: Thilina
* Date: 9/6/17
* Time: 7:22 AM
*/
namespace Test\Unit;
use Classes\BaseService;
class BaseServiceUnit extends \TestTemplate
{
public function testGet()
{
$baseService = BaseService::getInstance();
// create a user
//$user =
}
}

View File

@@ -2,6 +2,7 @@
namespace Test\Unit;
use Classes\LanguageManager;
use Gettext\Translations;
class LanguageManagerUnit extends \TestTemplate
{
@@ -20,4 +21,22 @@ class LanguageManagerUnit extends \TestTemplate
$this->assertEquals('User Logged In now', LanguageManager::translateTnrText('User <t>Logged In</t> now'));
fwrite(STDOUT, __METHOD__ . " End\n");
}
public function testGetTranslations() {
$enCount = $this->getTranslationCount('en');
$this->assertEquals($enCount, $this->getTranslationCount('de'));
$this->assertEquals($enCount, $this->getTranslationCount('es'));
$this->assertEquals($enCount, $this->getTranslationCount('fr'));
$this->assertEquals($enCount, $this->getTranslationCount('it'));
$this->assertEquals($enCount, $this->getTranslationCount('ja'));
$this->assertEquals($enCount, $this->getTranslationCount('pl'));
$this->assertEquals($enCount, $this->getTranslationCount('zh'));
}
private function getTranslationCount($lang) {
$trans = json_decode(LanguageManager::getTranslations($lang), true);
$count = count(array_keys($trans['messages']['']));
}
}