Exemple #1
0
        if ($_POST["selgrp"]) {
            $mitglieder = getMitglieder($_POST["gruppe"]);
        } else {
            if ($_POST["usrgrp"]) {
                if ($_POST["grpusr"]) {
                    $mitgl = array_unique($_POST["grpusr"]);
                } else {
                    $mitgl = "";
                }
                saveMitglieder($mitgl, $_POST["gruppe"]);
                $gruppe = -1;
            }
        }
    }
}
$grp = getGruppen();
$mit = getAllUser(array(0 => true, 1 => "%"));
$t = new Template($base);
doHeader($t);
$t->set_file(array("usr2" => "user3.tpl"));
$t->set_var(array(UID => $_SESSION["loginCRM"], msg => $msg));
$t->set_block("usr2", "Selectbox", "Block");
if ($grp) {
    foreach ($grp as $zeile) {
        if ($_POST["gruppe"] == $zeile["grpid"]) {
            $sel = " selected";
        } else {
            $sel = "";
        }
        $t->set_var(array(SEL => $sel, GRPID => $zeile["grpid"], NAME => $zeile["grpname"]));
        $t->parse("Block", "Selectbox", true);
function vartpl(&$t, $daten, $typ, $msg, $btn1, $btn2, $tpl, $suchmaske = false, $ui = false)
{
    $jscal = "<style type='text/css'>@import url(../js/jscalendar/calendar-win2k-1.css);</style>\n";
    $jscal .= "<script type='text/javascript' src='../js/jscalendar/calendar.js'></script>\n";
    $jscal .= "<script type='text/javascript' src='../js/jscalendar/lang/calendar-de.js'></script>\n";
    $jscal .= "<script type='text/javascript' src='../js/jscalendar/calendar-setup.js'></script>\n";
    if (isset($daten["grafik"])) {
        if ($typ == "C") {
            $DIR = "C" . $daten["customernumber"];
        } else {
            $DIR = "V" . $daten["vendornumber"];
        }
        if (file_exists("dokumente/" . $_SESSION["dbname"] . "/{$DIR}/logo." . $daten["grafik"])) {
            $Image = "<img src='dokumente/" . $_SESSION["dbname"] . "/{$DIR}/logo." . $daten["grafik"] . "' " . $daten["icon"] . ">";
        } else {
            $Image = "Bild ({$DIR}/logo." . $daten["grafik"] . ") nicht<br>im Verzeichnis";
        }
    } else {
        $Image = '';
    }
    $tmp = false;
    if (!$suchmaske) {
        $tmp = getVariablen($daten["id"]);
    }
    $varablen = $tmp > 0 ? count($tmp) . " Variablen" : "";
    if ($ui) {
        $t->set_file(array("fa1" => "companies" . $tpl . ".tpl"));
    } else {
        $t->set_file(array("fa1" => "firmen" . $tpl . ".tpl"));
    }
    if (isset($daten["employee"]) and $daten['employee'] > 0) {
        $employee = $daten["employee"];
    } else {
        if (isset($daten["modemployee"])) {
            $employee = "ERP " . $daten["modemployee"];
        } else {
            $employee = '';
        }
    }
    $t->set_var(array('FAART' => $typ == "C" ? ".:Customer:." : ".:Vendor:.", 'FAART2' => $typ == "C" ? ".:Customer Name:." : ".:Vendor Name:.", 'mtime' => isset($daten["mtime"]) ? $daten['mtime'] : '', 'Q' => $typ, 'Btn1' => $btn1, 'Btn2' => $btn2, 'Msg' => $msg, 'preon' => isset($daten["pre"]) ? "checked" : '', 'action' => $ui ? "" : "firmen" . $tpl . ".php?Q={$typ}", 'id' => isset($daten["id"]) ? $daten['id'] : '', 'customernumber' => isset($daten["customernumber"]) ? $daten["customernumber"] : '', 'vendornumber' => isset($daten["vendornumber"]) ? $daten["vendornumber"] : '', 'kdnr' => isset($daten["nummer"]) ? $daten["nummer"] : '', 'v_customer_id' => isset($daten["v_customer_id"]) ? $daten["v_customer_id"] : '', 'name' => isset($daten["name"]) ? $daten["name"] : '', 'greeting_' => isset($daten["greeting_"]) ? $daten["greeting_"] : '', 'department_1' => isset($daten["department_1"]) ? $daten["department_1"] : '', 'department_2' => isset($daten["department_2"]) ? $daten["department_2"] : '', 'street' => isset($daten["street"]) ? $daten["street"] : '', 'country' => isset($daten["country"]) ? $daten["country"] : '', 'zipcode' => isset($daten["zipcode"]) ? $daten["zipcode"] : '', 'city' => isset($daten["city"]) ? $daten["city"] : '', 'phone' => isset($daten["phone"]) ? $daten["phone"] : '', 'fax' => isset($daten["fax"]) ? $daten["fax"] : '', 'email' => isset($daten["email"]) ? $daten["email"] : '', 'homepage' => isset($daten["homepage"]) ? $daten["homepage"] : '', 'sw' => isset($daten["sw"]) ? $daten["sw"] : '', 'konzern' => isset($daten["konzern"]) ? $daten["konzern"] : '', 'konzernname' => isset($daten["konzernname"]) ? $daten["konzernname"] : '', 'branche_' => isset($daten["branche_"]) ? $daten["branche_"] : '', 'ustid' => isset($daten["ustid"]) ? $daten["ustid"] : '', 'taxnumber' => isset($daten["taxnumber"]) ? $daten["taxnumber"] : '', 'contact' => isset($daten["contact"]) ? $daten["contact"] : '', 'leadsrc' => isset($daten["leadsrc"]) ? $daten["leadsrc"] : '', 'notes' => isset($daten["notes"]) ? $daten["notes"] : '', 'bank' => isset($daten["bank"]) ? $daten["bank"] : '', 'bank_code' => isset($daten["bank_code"]) ? $daten["bank_code"] : '', 'iban' => isset($daten["iban"]) ? $daten["iban"] : '', 'bic' => isset($daten["bic"]) ? $daten["bic"] : '', 'headcount' => isset($daten["headcount"]) ? $daten["headcount"] : '', 'direct_debit' . (isset($daten['direct_debit']) ? $daten['direct_debit'] : '') => "checked", 'account_number' => isset($daten["account_number"]) ? $daten["account_number"] : '', 'terms' => isset($daten["terms"]) ? $daten["terms"] : '', 'kreditlim' => isset($daten["creditlimit"]) ? $daten["creditlimit"] : '', 'umsatz' => isset($daten["umsatz"]) ? $daten["umsatz"] : '', 'op' => isset($daten["op"]) ? $daten["op"] : '', 'preisgrp' => isset($daten["preisgroup"]) ? $daten["preisgroup"] : '', 'IMG' => $Image, 'grafik' => isset($daten["grafik"]) ? $daten["grafik"] : '', 'init' => $employee, 'login' => $_SESSION["login"], 'employee' => $_SESSION["loginCRM"], 'password' => isset($_SESSION["password"]) ? $_SESSION["password"] : '', 'txid' . (isset($daten["taxzone_id"]) ? $daten["taxzone_id"] : '') => "selected", 'GEODB' => $_SESSION['GEODB'] == 't' ? '1==1' : '1>2', 'GEOS' => $_SESSION['GEODB'] == 't' ? "visible" : "hidden", 'GEO1' => $_SESSION['GEODB'] == 't' ? '' : "!--", 'GEO2' => $_SESSION['GEODB'] == 't' ? '' : "--", 'BLZ1' => $_SESSION['BLZDB'] == 't' ? '' : "!--", 'BLZ2' => $_SESSION['BLZDB'] == 't' ? '' : "--", 'cvars' => isset($daten['id']) ? cvar_edit($daten["id"]) : '', 'variablen' => $varablen));
    $jahre = getUmsatzJahre($typ == "C" ? "ar" : "ap");
    doBlock($t, "fa1", "YearListe", "YL", $jahre, "year", "year", $daten["year"]);
    $lang = getLanguage();
    doBlock($t, "fa1", "LAnguage", "LA", $lang, "id", "description", $daten["language_id"]);
    $kdtyp = getBusiness();
    doBlock($t, "fa1", "TypListe", "BT", $kdtyp, "id", "description", $daten["business_id"]);
    $lead = getLeads();
    doBlock($t, "fa1", "LeadListe", "LL", $lead, "id", "lead", $daten["lead"]);
    if (isset($daten['id'])) {
        $shiptos = getAllShipto($daten["id"], $typ);
        doBlock($t, "fa1", "shiptos", "ST", $shiptos, "shipto_id", array("shiptoname", "shiptostreet", "shiptocity"), false);
    }
    $anreden = getAnreden();
    doBlock($t, "fa1", "anreden", "A", $anreden, "greeting", "greeting", isset($daten["greeting"]) ? $daten["greeting"] : '');
    $payment = getPayment();
    doBlock($t, "fa1", "payment", "P", $payment, "id", "description", isset($daten["payment_id"]) ? $daten["payment_id"] : '');
    $branchen = getBranchen();
    doBlock($t, "fa1", "branchen", "BR", $branchen, "branche", "branche", isset($daten["branche"]) ? $daten["branche"] : '');
    $bundesland = getBundesland(strtoupper($daten["country"]));
    doBlock($t, "fa1", "buland", "BL", $bundesland, "id", "bundesland", isset($daten["bland"]) ? $daten["bland"] : '');
    $curr = getCurrencies();
    doBlock($t, "fa1", "currency", "C", $curr, "id", "name", isset($daten["currency_id"]) ? $daten["currency_id"] : '');
    $cvars = getCvars();
    $t->set_block('fa1', 'cvarListe', 'BlockCV');
    if ($cvars) {
        $i = 1;
        foreach ($cvars as $cvar) {
            switch ($cvar["type"]) {
                case "bool":
                    $fld = "<input type='checkbox' name='vc_cvar_" . $cvar["name"] . "' value='t'";
                    if (isset($daten["vc_cvar_" . $cvar["name"]]) and $daten["vc_cvar_" . $cvar["name"]] == "t") {
                        $fld .= " checked";
                    }
                    $fld .= ">";
                    break;
                case "date":
                    $fld = "<input type='text' name='vc_cvar_" . $cvar["name"] . "' size='10' value='";
                    $fld .= db2date($daten["vc_cvar_" . $cvar["name"]]) . "' id='cvar_" . $cvar["name"] . "'>";
                    $fld .= "<input name='cvar_" . $cvar["name"] . "_button' id='cvar_" . $cvar["name"] . "_trigger' type='button' value='?'>";
                    $fld .= '<script type="text/javascript"><!-- ' . "\n";
                    $fld .= 'Calendar.setup({ inputField : "cvar_' . $cvar["name"] . '",';
                    $fld .= 'ifFormat   : "%d.%m.%Y",';
                    $fld .= 'align      : "BL",';
                    $fld .= 'button     : "cvar_' . $cvar["name"] . '_trigger"});';
                    $fld .= "\n" . '--></script>' . "\n";
                    break;
                case "select":
                    $o = explode("##", $cvar["options"]);
                    $fld = "<select name='vc_cvar_" . $cvar["name"] . "'>\n<option value=''>---------\n";
                    foreach ($o as $tmp) {
                        $fld .= "<option value='{$tmp}'";
                        if ($daten["vc_cvar_" . $cvar["name"]] == $tmp) {
                            $fld .= " selected";
                        }
                        $fld .= ">{$tmp}\n";
                    }
                    $fld .= "</select>";
                    break;
                case "customer":
                    $name = getCvarName($daten['vc_cvar_' . $cvar['name']]);
                    $fld = "<input type='hidden' name='vc_cvar_" . $cvar["name"] . "' value='";
                    $fld .= $daten['vc_cvar_' . $cvar['name']] . "'>";
                    $fld .= $name . ' (' . $daten['vc_cvar_' . $cvar['name']] . ')';
                    break;
                default:
                    $fld = '<input type="text" name="vc_cvar_' . $cvar['name'] . '" value="';
                    $fld .= $daten['vc_cvar_' . $cvar['name']] . '">';
            }
            $t->set_var(array('varlable' . $i => $cvar["description"], 'varfld' . $i => $fld));
            if ($i == 1) {
                $i = 2;
            } else {
                $i = 1;
                $t->parse('BlockCV', 'cvarListe', true);
            }
        }
        if ($i == 2) {
            $t->set_var(array('varlable2' => "", 'varfld2' => ""));
            $t->parse('BlockCV', 'cvarListe', true);
        }
    }
    if (!$suchmaske) {
        $bundesland = getBundesland(strtoupper($daten["shiptocountry"]));
        doBlock($t, "fa1", "buland2", "BS", $bundesland, "id", "bundesland", $daten["shiptobland"]);
        $employees = getAllUser(array(0 => true, 1 => "%"));
        doBlock($t, "fa1", "SalesmanListe", "SM", $employees, "id", "name", $daten["salesman_id"]);
        /* Check if the user is allowed to change the access group - Behaviour changed by DO:
           Let (all) users change the group if none is set yet */
        if (!isset($daten["employee"]) || $daten["employee"] == $_SESSION["loginCRM"] || $daten["modemployee"] == $_SESSION["loginCRM"]) {
            $first[] = array("grpid" => "", "rechte" => "w", "grpname" => ".:public:.");
            $first[] = array("grpid" => $_SESSION["loginCRM"], "rechte" => "w", "grpname" => ".:personal:.");
            $grps = getGruppen();
            if ($grps) {
                $user = array_merge($first, $grps);
            } else {
                $user = $first;
            }
            doBlock($t, "fa1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["owener"]);
        } else {
            $user[0] = array("grpid" => $daten["owener"], "grpname" => $daten["owener"] ? getOneGrp($daten["owener"]) : ".:public:.");
            doBlock($t, "fa1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["owener"]);
            /*$t->set_var(array(
                  grpid => $daten["owener"],
                  Gsel => "selected",
                  Gname => ($daten["owener"])?getOneGrp($daten["owener"]):".:public:.",
              ));
              $t->parse("Block","OwenerListe",true);*/
        }
    }
    //if (!$suchmaske)
}
Exemple #3
0
<?php

require_once "inc/stdLib.php";
include "inc/template.inc";
include "inc/crmLib.php";
include_once "inc/UserLib.php";
$templ = "wvln.tpl";
$t = new Template($base);
doHeader($t);
$t->set_file(array("wvl" => $templ));
$t->set_var(array('timeout' => $_SESSION['interv'] * 1000));
$sel = $_SESSION["loginCRM"];
$usr = getAllUser(array(0 => true, 1 => "%"));
$gruppen = getGruppen(true);
$nouser[0] = array("login" => "-----", "id" => 0);
$user = array_merge($nouser, $usr);
$user = array_merge($user, $gruppen);
$t->set_block("wvl", "Selectbox", "Block1");
if ($user) {
    foreach ($user as $zeile) {
        $t->set_var(array('Sel' => $sel == $zeile["id"] ? " selected" : "", 'UID' => $zeile["id"], 'Login' => (isset($zeile['name']) and $zeile['name'] != '') ? $zeile['name'] : $zeile["login"]));
        $t->parse("Block1", "Selectbox", true);
    }
}
$t->Lpparse("out", array("wvl"), $_SESSION['countrycode'], "work");
Exemple #4
0
function vartplP(&$t, $daten, $msg, $btn1, $btn2, $btn3, $fld, $bgcol, $fid, $tab, $ui = false)
{
    //global $laender;
    //cp_greeting raus hli
    if ($daten["cp_cv_id"] && $daten["Quelle"]) {
        $fa = getFirmenstamm($daten["cp_cv_id"], false, $daten["Quelle"]);
        $nummer = $daten["Quelle"] == "C" ? $fa["customernumber"] : $fa["vendornumber"];
    }
    if (trim($daten["cp_grafik"]) != "") {
        if ($nummer) {
            $root = "dokumente/" . $_SESSION["dbname"] . "/" . $daten["Quelle"] . $nummer . "/" . $daten["cp_id"];
        } else {
            $root = "dokumente/" . $_SESSION["dbname"] . "/" . $daten["cp_id"];
        }
        $Image = "<img src='{$root}/kopf" . $daten["cp_id"] . "." . $daten["cp_grafik"] . "' " . $daten["icon"] . ">";
        $tmp = glob("{$root}/vcard" . $daten["cp_id"] . ".*");
        if ($tmp) {
            foreach ($tmp as $vcard) {
                $ext = explode(".", $vcard);
                $ext = strtolower($ext[count($ext) - 1]);
                if (in_array($ext, array("jpg", "jpeg", "gif", "png", "pdf", "ps"))) {
                    $VCARD = "<img src='{$root}/vcard" . $daten["cp_id"] . ".{$ext}' width='110' height='80'>";
                    break;
                }
            }
        }
    }
    if ($ui) {
        $t->set_file(array("pers1" => "persons1Result.tpl"));
    } else {
        $t->set_file(array("pers1" => "personen" . $tab . ".tpl"));
    }
    $t->set_var(array('ERPCSS' => $_SESSION['baseurl'] . 'crm/css/' . $_SESSION["stylesheet"], 'Fld' => $fld, 'JS' => "goFld();", 'color' => $bgcol, 'BgC' => $fid, 'Btn1' => $btn1, 'Btn3' => $btn3, 'Msg' => $msg, 'preon' => isset($daten["pre"]) ? "checked" : "", 'action' => "personen" . $tab . ".php", 'mtime' => $daten["mtime"], 'PID' => $daten["cp_id"], 'tabelle' => $daten["tabelle"], 'nummer' => isset($nummer) ? $nummer : '', 'cp_title' => $daten["cp_title"], 'cp_givenname' => $daten["cp_givenname"], 'cp_name' => $daten["cp_name"], 'cp_gender' . $daten["cp_gender"] => "selected", 'cp_salutation_' => isset($daten["cp_salutation_"]) ? $daten["cp_salutation_"] : '', 'cp_street' => $daten["cp_street"], 'cp_country' => $daten["cp_country"], 'cp_zipcode' => $daten["cp_zipcode"], 'cp_city' => $daten["cp_city"], 'cp_phone1' => $daten["cp_phone1"], 'cp_phone2' => $daten["cp_phone2"], 'cp_privatphone' => $daten["cp_privatphone"], 'cp_mobile1' => $daten["cp_mobile1"], 'cp_mobile2' => $daten["cp_mobile2"], 'cp_fax' => $daten["cp_fax"], 'cp_email' => $daten["cp_email"], 'cp_privatemail' => $daten["cp_privatemail"], 'cp_homepage' => $daten["cp_homepage"], 'cp_birthday' => $daten["cp_birthday"] ? db2date($daten["cp_birthday"]) : "", 'cp_beziehung' => $daten["cp_beziehung"], 'cp_abteilung' => $daten["cp_abteilung"], 'cp_position' => $daten["cp_position"], 'Firma' => $daten["Firma"], 'FID' => $daten["cp_cv_id"], 'FID1' => $fid, 'cp_stichwort1' => $daten["cp_stichwort1"], 'cp_notes' => $daten["cp_notes"], 'Quelle' => $daten["Quelle"], 'IMG' => isset($Image) ? $Image : '', 'IMG_' => $daten["cp_grafik"], 'visitenkarte' => isset($VCARD) ? $VCARD : '', 'init' => $daten["cp_employee"] ? $daten["cp_employee"] : "ERP", 'employee' => $_SESSION["loginCRM"]));
    if ($daten["cp_employee"] == $_SESSION["loginCRM"]) {
        $first[] = array("grpid" => "", "rechte" => "w", "grpname" => ".:public:.");
        $first[] = array("grpid" => $daten["cp_employee"], "rechte" => "w", "grpname" => ".:personal:.");
        $grp = getGruppen();
        if ($grp) {
            $user = array_merge($first, $grp);
        } else {
            $user = $first;
        }
        doBlock($t, "pers1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["cp_owener"]);
    } else {
        $user[0] = array("grpid" => $daten["cp_owener"], "grpname" => $daten["cp_owener"] ? getOneGrp($daten["cp_owener"]) : ".:public:.");
        doBlock($t, "pers1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["cp_owener"]);
    }
    $anreden = getCpBriefAnreden();
    doBlock($t, "pers1", "briefanred", "BA", $anreden, "cp_salutation", "cp_salutation", $daten["cp_salutation"]);
}