Esempio n. 1
0
     $tpl->assign('rate', get_rate($kga['usr']['usr_ID'], NULL, NULL));
     $tpl->display("preferences.tpl");
     break;
     /**
      * Display the dialog to add or edit a customer.
      */
 /**
  * Display the dialog to add or edit a customer.
  */
 case 'add_edit_knd':
     if (isset($kga['customer']) || $kga['usr']['usr_sts'] == 2) {
         die;
     }
     if ($id) {
         // Edit mode. Fill the dialog with the data of the customer.
         $data = knd_get_data($id);
         if ($data) {
             $tpl->assign('knd_name', $data['knd_name']);
             $tpl->assign('knd_comment', $data['knd_comment']);
             $tpl->assign('knd_password', $data['knd_password']);
             $tpl->assign('knd_company', $data['knd_company']);
             $tpl->assign('knd_vat', $data['knd_vat']);
             $tpl->assign('knd_contact', $data['knd_contact']);
             $tpl->assign('knd_street', $data['knd_street']);
             $tpl->assign('knd_zipcode', $data['knd_zipcode']);
             $tpl->assign('knd_city', $data['knd_city']);
             $tpl->assign('knd_tel', $data['knd_tel']);
             $tpl->assign('knd_fax', $data['knd_fax']);
             $tpl->assign('knd_mobile', $data['knd_mobile']);
             $tpl->assign('knd_mail', $data['knd_mail']);
             $tpl->assign('knd_homepage', $data['knd_homepage']);
Esempio n. 2
0
    $tpl->assign('recstate', get_rec_state($kga['usr']['usr_ID']));
} else {
    $tpl->assign('recstate', 0);
}
$tpl->assign('lang_checkUsername', $kga['lang']['checkUsername']);
$tpl->assign('lang_checkGroupname', $kga['lang']['checkGroupname']);
$knd_data = array('knd_ID' => false, 'knd_name' => '');
$pct_data = array('pct_ID' => false, 'pct_name' => '');
$evt_data = array('evt_ID' => false, 'evt_name' => '');
if (!isset($kga['customer'])) {
    //$lastZefRecord = zef_get_data(false);
    $last_pct = pct_get_data($kga['usr']['lastProject']);
    $last_evt = evt_get_data($kga['usr']['lastEvent']);
    if (!$last_pct['pct_trash']) {
        $pct_data = $last_pct;
        $knd_data = knd_get_data($last_pct['pct_kndID']);
    }
    if (!$last_evt['evt_trash']) {
        $evt_data = $last_evt;
    }
}
$tpl->assign('knd_data', $knd_data);
$tpl->assign('pct_data', $pct_data);
$tpl->assign('evt_data', $evt_data);
// =========================================
// = INCLUDE EXTENSION PHP FILE            =
// =========================================
$extDir = WEBROOT . 'extensions';
if ($handle = opendir($extDir)) {
    chdir($extDir);
    $ext_configs = array();
Esempio n. 3
0
/**
 * Returns array for smarty's html_options funtion.
 *
 * <pre>
 * returns:
 * [0] -> pct/evt names
 * [1] -> values as IDs
 * </pre>
 *
 * @param string either 'pct', 'evt', 'knd', 'grp'
 * @return array
 * @author th, sl, kp
 */
function makeSelectBox($subject, $user, $selection = null)
{
    global $kga;
    $sel = array();
    $sel[0] = array();
    $sel[1] = array();
    switch ($subject) {
        case 'pct':
            $arr_pct = get_arr_pct($user);
            $i = 0;
            foreach ($arr_pct as $pct) {
                if ($pct['pct_visible']) {
                    if ($kga['conf']['flip_pct_display']) {
                        $sel[0][$i] = $pct['knd_name'] . ": " . $pct['pct_name'];
                        if ($kga['conf']['pct_comment_flag']) {
                            $sel[0][$i] .= "(" . $pct['pct_comment'] . ")";
                        }
                    } else {
                        $sel[0][$i] = $pct['pct_name'] . " (" . $pct['knd_name'] . ")";
                        if ($kga['conf']['pct_comment_flag']) {
                            $sel[0][$i] .= "(" . $pct['pct_comment'] . ")";
                        }
                    }
                    $sel[1][$i] = $pct['pct_ID'];
                    $i++;
                }
            }
            break;
        case 'evt':
            $arr_evt = get_arr_evt($user);
            $i = 0;
            foreach ($arr_evt as $evt) {
                if ($evt['evt_visible']) {
                    $sel[0][$i] = $evt['evt_name'];
                    $sel[1][$i] = $evt['evt_ID'];
                    $i++;
                }
            }
            break;
        case 'knd':
            $arr_knd = get_arr_knd($user);
            $i = 0;
            $selectionFound = false;
            foreach ($arr_knd as $knd) {
                if ($knd['knd_visible']) {
                    $sel[0][$i] = $knd['knd_name'];
                    $sel[1][$i] = $knd['knd_ID'];
                    $i++;
                    if ($selection == $knd['knd_ID']) {
                        $selectionFound = true;
                    }
                }
            }
            if ($selection != null && !$selectionFound) {
                $data = knd_get_data($selection);
                $sel[0][$i] = $data['knd_name'];
                $sel[1][$i] = $data['knd_ID'];
            }
            break;
        case 'grp':
            $arr_grp = get_arr_grp();
            $i = 0;
            foreach ($arr_grp as $grp) {
                if (!$grp['grp_trash']) {
                    $sel[0][$i] = $grp['grp_name'];
                    $sel[1][$i] = $grp['grp_ID'];
                    $i++;
                }
            }
            break;
        default:
            // TODO leave default options empty ???
            break;
    }
    return $sel;
}
Esempio n. 4
0
     $zefData['zlocation'] = $zefData['zef_location'];
     $zefData['trackingnr'] = $zefData['zef_trackingnr'];
     $zefData['comment'] = $zefData['zef_comment'];
     $zefData['comment_type'] = $zefData['zef_comment_type'];
     $zefData['rate'] = $zefData['zef_rate'];
     $zefData['cleared'] = $zefData['zef_cleared'];
     $newZefId = zef_create_record($kga['usr']['usr_ID'], $zefData);
     $usrData = array();
     $usrData['lastRecord'] = $newZefId;
     $usrData['lastProject'] = $zefData['pct_ID'];
     $usrData['lastEvent'] = $zefData['evt_ID'];
     usr_edit($kga['usr']['usr_ID'], $usrData);
     $pctdata = pct_get_data($zefData['zef_pctID']);
     $return = 'pct_name = "' . $pctdata['pct_name'] . '"; ';
     $return .= 'knd = "' . $pctdata['pct_kndID'] . '"; ';
     $knddata = knd_get_data($pctdata['pct_kndID']);
     $return .= 'knd_name = "' . $knddata['knd_name'] . '"; ';
     $evtdata = evt_get_data($zefData['zef_evtID']);
     $return .= 'evt_name = "' . $evtdata['evt_name'] . '"; ';
     echo $return;
     // TODO return false if error
     break;
     // ==================
     // = stop recording =
     // ==================
 // ==================
 // = stop recording =
 // ==================
 case 'stop':
     if (isset($kga['customer'])) {
         die;
Esempio n. 5
0
         } else {
             $exp_info['name'] = $kga['lang']['xp_ext']['expense'] . ': ' . $one_entry['evt_name'];
             $exp_info['time'] = -1;
             $exp_info['wage'] = $one_entry['wage'];
             $exp_summary[] = $exp_info;
         }
     }
     $summary = array_merge($zef_summary, $exp_summary);
     $tpl->assign('summary', $summary);
 } else {
     $tpl->assign('summary', 0);
 }
 // Create filter descirption, Same is in PDF export
 $customers = array();
 foreach ($filterKnd as $knd_id) {
     $customer_info = knd_get_data($knd_id);
     $customers[] = $customer_info['knd_name'];
 }
 $tpl->assign('customersFilter', implode(', ', $customers));
 $projects = array();
 foreach ($filterPct as $pct_id) {
     $project_info = pct_get_data($pct_id);
     $projects[] = $project_info['pct_name'];
 }
 $tpl->assign('projectsFilter', implode(', ', $projects));
 $tpl->assign('arr_data', count($arr_data) > 0 ? $arr_data : 0);
 $tpl->assign('columns', $columns);
 $tpl->assign('custom_timeformat', $timeformat);
 $tpl->assign('custom_dateformat', $dateformat);
 $tpl->assign('timeSum', $timeSum);
 $tpl->assign('wageSum', $wageSum);