Skip to content

Commit

Permalink
0.5.3 rev 3444
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Apr 18, 2014
1 parent 5e16211 commit aefd7d8
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 16 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.3 rev 3440
0.5.3 rev 3444
87 changes: 79 additions & 8 deletions api/libs/api.teskman.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function em_EmployeeShowForm() {
$cells.= wf_TableCell(__('Active'));
$cells.= wf_TableCell(__('Appointment'));
$cells.= wf_TableCell(__('Mobile'));
$cells.= wf_TableCell(__('Administrator'));
$cells.= wf_TableCell(__('Actions'));
$rows = wf_TableRow($cells, 'row1');

Expand All @@ -19,6 +20,7 @@ function em_EmployeeShowForm() {
$cells.= wf_TableCell(web_bool_led($eachemployee['active']));
$cells.= wf_TableCell($eachemployee['appointment']);
$cells.= wf_TableCell($eachemployee['mobile']);
$cells.= wf_TableCell($eachemployee['admlogin']);
$actions= wf_JSAlert('?module=employee&delete='.$eachemployee['id'], web_delete_icon(), 'Removing this may lead to irreparable results');
$actions.= wf_JSAlert('?module=employee&edit='.$eachemployee['id'], web_edit_icon(), 'Are you serious');
$cells.= wf_TableCell($actions);
Expand All @@ -34,6 +36,7 @@ function em_EmployeeShowForm() {
$inputs.= wf_TableCell('');
$inputs.= wf_TableCell(wf_TextInput('employeejob', '', '', false, 20));
$inputs.= wf_TableCell(wf_TextInput('employeemobile', '', '', false, 15));
$inputs.= wf_TableCell(wf_TextInput('employeeadmlogin', '', '', false, 10));
$inputs.= wf_TableCell(wf_Submit(__('Create')));
$inputs= wf_TableRow($inputs, 'row2');
$addForm= wf_Form("", 'POST', $inputs, '');
Expand Down Expand Up @@ -78,20 +81,23 @@ function em_JobTypeForm() {
show_window(__('Job types'),$result);
}

function em_EmployeeAdd($name,$job,$mobile='') {
function em_EmployeeAdd($name,$job,$mobile='',$admlogin='') {
$name=mysql_real_escape_string(trim($name));
$job=mysql_real_escape_string(trim($job));
$mobile= mysql_real_escape_string($mobile);
$admlogin= mysql_real_escape_string($admlogin);

$query="
INSERT INTO `employee` (
`id` ,
`name` ,
`appointment`,
`mobile`,
`admlogin`,
`active`
)
VALUES (
NULL , '".$name."', '".$job."','".$mobile."' , '1'
NULL , '".$name."', '".$job."','".$mobile."', '".$admlogin."' , '1'
);
";

Expand Down Expand Up @@ -362,10 +368,21 @@ function ts_JGetUndoneTasks() {
$alljobtypes= ts_GetAllJobtypes();
$curyear=curyear();
$curmonth=date("m");

//per employee filtering
$displaytype = (isset($_POST['displaytype'])) ? $_POST['displaytype'] : 'all';
if ($displaytype=='onlyme') {
$whoami=whoami();
$curempid= ts_GetEmployeeByLogin($whoami);
$appendQuery=" AND `employee`='".$curempid."'";
} else {
$appendQuery='';
}

if (($curmonth!=1) AND ($curmonth!=12)) {
$query="SELECT * from `taskman` WHERE `status`='0' AND `startdate` LIKE '".$curyear."-%' ORDER BY `date` ASC";
$query="SELECT * from `taskman` WHERE `status`='0' AND `startdate` LIKE '".$curyear."-%' ".$appendQuery." ORDER BY `date` ASC";
} else {
$query="SELECT * from `taskman` WHERE `status`='0' ORDER BY `date` ASC";
$query="SELECT * from `taskman` WHERE `status`='0' ".$appendQuery." ORDER BY `date` ASC";
}

$allundone= simple_queryall($query);
Expand Down Expand Up @@ -412,10 +429,21 @@ function ts_JGetDoneTasks() {

$curyear=curyear();
$curmonth=date("m");

//per employee filtering
$displaytype = (isset($_POST['displaytype'])) ? $_POST['displaytype'] : 'all';
if ($displaytype=='onlyme') {
$whoami=whoami();
$curempid= ts_GetEmployeeByLogin($whoami);
$appendQuery=" AND `employee`='".$curempid."'";
} else {
$appendQuery='';
}

if (($curmonth!=1) AND ($curmonth!=12)) {
$query="SELECT * from `taskman` WHERE `status`='1' AND `startdate` LIKE '".$curyear."-%' ORDER BY `date` ASC";
$query="SELECT * from `taskman` WHERE `status`='1' AND `startdate` LIKE '".$curyear."-%' ".$appendQuery." ORDER BY `date` ASC";
} else {
$query="SELECT * from `taskman` WHERE `status`='1' ORDER BY `date` ASC";
$query="SELECT * from `taskman` WHERE `status`='1' ".$appendQuery." ORDER BY `date` ASC";
}

$allundone= simple_queryall($query);
Expand Down Expand Up @@ -461,10 +489,20 @@ function ts_JGetAllTasks() {
$curyear=curyear();
$curmonth=date("m");

//per employee filtering
$displaytype = (isset($_POST['displaytype'])) ? $_POST['displaytype'] : 'all';
if ($displaytype=='onlyme') {
$whoami=whoami();
$curempid= ts_GetEmployeeByLogin($whoami);
$appendQuery=" AND `employee`='".$curempid."'";
} else {
$appendQuery='';
}

if (($curmonth!=1) AND ($curmonth!=12)) {
$query="SELECT * from `taskman` WHERE `startdate` LIKE '".$curyear."-%' ORDER BY `date` ASC";
$query="SELECT * from `taskman` WHERE `startdate` LIKE '".$curyear."-%' ".$appendQuery." ORDER BY `date` ASC";
} else {
$query="SELECT * from `taskman` ORDER BY `date` ASC";
$query="SELECT * from `taskman` ".$appendQuery." ORDER BY `date` ASC";
}

$allundone= simple_queryall($query);
Expand Down Expand Up @@ -643,6 +681,20 @@ function ts_ShowPanel() {
$result.=wf_Link('?module=taskman&show=all', __('List all tasks'), false, 'ubButton');
$result.=wf_Link('?module=taskman&lateshow=true', __('Show late'), false, 'ubButton');
$result.=wf_Link('?module=taskman&print=true', __('Tasks printing'), false, 'ubButton');

//show type selector
$whoami=whoami();
$employeeid= ts_GetEmployeeByLogin($whoami);
if ($employeeid) {
$result.=wf_delimiter();
$curselected = (isset($_POST['displaytype'])) ? $_POST['displaytype'] : '' ;
$displayTypes=array('all'=>__('Show tasks for all users'),'onlyme'=>__('Show only mine tasks'));
$inputs= wf_Selector('displaytype', $displayTypes, '', $curselected, false);
$inputs.= wf_Submit('Show');
$showTypeForm= wf_Form('', 'POST', $inputs, 'glamour');
$result.=$showTypeForm;
}

return ($result);
}

Expand Down Expand Up @@ -1120,5 +1172,24 @@ function ts_ShowLate() {
$result= wf_TableBody($rows, '100%', '0', 'sortable');
return ($result);
}

/*
* Gets employee by administrator login
*
* @param $login logged in administrators login
*
* @return mixed
*/
function ts_GetEmployeeByLogin($login) {
$login= mysql_real_escape_string($login);
$query="SELECT `id` from `employee` WHERE `admlogin`='".$login."'";
$raw= simple_query($query);
if (!empty($raw)) {
$result=$raw['id'];
} else {
$result=false;
}
return ($result);
}

?>
3 changes: 2 additions & 1 deletion api/libs/api.ukv.php
Original file line number Diff line number Diff line change
Expand Up @@ -2556,12 +2556,13 @@ public function reportFees() {
$rowsf.= wf_TableRow($cells, 'row3');
$feesCount++;
$feesSumm=$feesSumm+$eachPayment['summ'];
$csvData.=$eachPayment['id'].';'.$eachPayment['date'].';'.$eachPayment['summ'].';'.$userAddress.';'.$userRealName."\n";
$csvData.=$eachPayment['id'].';'.$eachPayment['date'].';'.$eachPayment['summ'].';'.$userAddress.';'.$userRealName."\r"."\n";
}
}

//saving downloadable report
$csvSaveName=$searchFees.'_ukvfeesreport.csv';
$csvData= iconv('utf-8', 'windows-1251', $csvData);
file_put_contents('exports/'.$csvSaveName, $csvData);
$downloadLink= wf_Link(self::URL_REPORTS_MGMT.'reportFees&downloadfeereport='.base64_encode($csvSaveName), wf_img('skins/excel.gif', __('Download')), false);

Expand Down
3 changes: 3 additions & 0 deletions docs/test_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1099,3 +1099,6 @@ CREATE TABLE IF NOT EXISTS `signup_prices_users` (
`price` double NOT NULL,
PRIMARY KEY (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 0.5.3 update
ALTER TABLE `employee` ADD `admlogin` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `mobile`;
4 changes: 2 additions & 2 deletions languages/russian/billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,8 @@

//rev 3439
$lang['def']['Users who have zero balance'] = 'Пользователи с нулевым балансом';
$lang['def'][''] = '';
$lang['def'][''] = '';
$lang['def']['Show tasks for all users'] = 'Показать задачи для всех работников';
$lang['def']['Show only mine tasks'] = 'Показать задачи только для меня';
$lang['def'][''] = '';
$lang['def'][''] = '';
$lang['def'][''] = '';
Expand Down
5 changes: 5 additions & 0 deletions languages/ukrainian/billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1660,4 +1660,9 @@
$lang['def']['Switch ping custom script'] = 'Скрипт кастомного опиту комутаторів';
$lang['def']['right to delete UKV users'] = 'Право видаляти користувачів УКВ';

//rev 3439
$lang['def']['Users who have zero balance'] = 'Користувачі з нульовим балансом';
$lang['def']['Show tasks for all users'] = 'Показати задачі для всіх працівників';
$lang['def']['Show only mine tasks'] = 'Показати задачі тільки для мене';

?>
6 changes: 4 additions & 2 deletions modules/general/employee/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if (cfr('EMPLOYEE')) {

if (wf_CheckPost(array('addemployee','employeename'))) {
em_EmployeeAdd($_POST['employeename'], $_POST['employeejob'], @$_POST['employeemobile']);
em_EmployeeAdd($_POST['employeename'], $_POST['employeejob'], @$_POST['employeemobile'],@$_POST['employeeadmlogin']);
rcms_redirect("?module=employee");
}

Expand Down Expand Up @@ -49,13 +49,14 @@
}

} else {
$editemployee=vf($_GET['edit']);
$editemployee=vf($_GET['edit'],3);

//if someone editing employee
if (isset($_POST['editname'])) {
simple_update_field('employee', 'name', $_POST['editname'], "WHERE `id`='".$editemployee."'");
simple_update_field('employee', 'appointment', $_POST['editappointment'], "WHERE `id`='".$editemployee."'");
simple_update_field('employee', 'mobile', $_POST['editmobile'], "WHERE `id`='".$editemployee."'");
simple_update_field('employee', 'admlogin', $_POST['editadmlogin'], "WHERE `id`='".$editemployee."'");

if (wf_CheckPost(array('editactive'))) {
simple_update_field('employee', 'active', '1', "WHERE `id`='".$editemployee."'");
Expand All @@ -77,6 +78,7 @@
$editinputs=wf_TextInput('editname','Real Name' , $employeedata['name'], true, 20);
$editinputs.=wf_TextInput('editappointment','Appointment' , $employeedata['appointment'], true, 20);
$editinputs.=wf_TextInput('editmobile', __('Mobile'), $employeedata['mobile'], true, 20);
$editinputs.=wf_TextInput('editadmlogin', __('Administrator'), $employeedata['admlogin'], true, 20);
$editinputs.=wf_CheckInput('editactive', 'Active', true, $actflag);
$editinputs.=wf_Submit('Save');
$editform=wf_Form('', 'POST', $editinputs, 'glamour');
Expand Down
2 changes: 0 additions & 2 deletions modules/general/taskman/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
if(cfr('TASKMAN')) {



//if someone creates new task
if (isset($_POST['createtask'])) {
if (wf_CheckPost(array('newstartdate','newtaskaddress','newtaskphone'))) {
Expand Down

0 comments on commit aefd7d8

Please sign in to comment.