genNum = "2", "g3_" <=> genNum = "3") $f_cmp_comp = trim($f_cmp_comp); $f_cmp_comp2 = trim($f_cmp_comp2); // Parameter for displayed column SEQUENCE /* $displayedListCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_COLS"); if ($displayedListCols == "") : $displayedListCols = getParameterValue("0", "MASK_CSCSC_LIST_COLS", $hqId); if ($displayedListCols == "") : // Default settings $displayedListCols = "cmp_comp,cmp_comp2,cs_eid,csc_name,cmp_match,cmp_authenticated_img,ad_street,cscad_hsno,ad_zipcode,ad_city,cscad_remark,cscad_person,cscad_phone,statistic"; endif; endif; */ $displayedListCols = "cmp_comp,cmp_comp2,cs_eid,cmp_match,cmp_authenticated_img,ad_street,cmp_hsno,ad_zipcode,ad_city,cmp_remark,usr_phone"; $displayedListColsArray = spliti(",",$displayedListCols); $displayedListColsArrayLen = count($displayedListColsArray); // Parameter for displayed column LENGTH /* $displayedListLenCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_LEN_COLS"); if ($displayedListLenCols == "") : $displayedListLenCols = getParameterValue("0", "MASK_CSCSC_LIST_LEN_COLS", $hqId); if ($displayedListLenCols == "") : // Default settings $displayedListLenCols = "30,15,11,20,30,5,20,5,5,20,20"; endif; endif; */ $displayedListLenCols = "30,15,11,30,5,20,5,5,20,20,20,15"; $displayedListLenColsArray = spliti(",",$displayedListLenCols); // Get constants for fields to be searched in $constSearchPtlistCmpcompCmpmatch = SEARCH_CSCSCLIST_CMPCOMP_CMPMATCH; // Use constant like definition for customer $constSearchPtlistCmpcompCseid = SEARCH_CSCSCLIST_CMPCOMP_CSEID; // Use constant like definition for customer $constSearchPtlistCmpcompCscadphone = SEARCH_CSCSCLIST_CMPCOMP_CSCADPHONE; // Use constant like definition for customer // Check consistence of used fields per JavaScript $tableHeaderSearchFieldsExtra = ""; // Defines the extra hidden fields to be integrated for search $j = array_search("cmp_match",$displayedListColsArray); if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= ""; endif; $j = array_search("cs_eid",$displayedListColsArray); if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= ""; endif; $j = array_search("cscad_phone",$displayedListColsArray); if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= ""; endif; $f_cmp_match = trim($f_cmp_match); if ($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match == "") : $f_cmp_match = trim($f_cmp_comp); endif; $f_cs_eid = trim($f_cs_eid); if ($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid == "") : $f_cs_eid = trim($f_cmp_comp); endif; $f_usr_phone = trim($f_usr_phone); if ($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone == "") : $f_usr_phone = trim($f_cmp_comp); endif; $f_usr_name = trim($f_usr_name); $f_usr_phone = trim($f_usr_phone); $f_usr_email = trim($f_usr_email); $f_street = trim($f_street); $f_hsno = trim($f_hsno); $f_zipcode = trim($f_zipcode); $f_city = trim($f_city); $f_country = trim($f_country); $f_remark = trim($f_remark); // Flag for "show invisible prospects" if ($f_show_invisible == "" || count($f_show_invisible) == 0) : $f_show_invisible = "0"; else: $f_show_invisible = "1"; endif; // OUTPUT: Page header option fields $pageHeaderOptionFields = ""; if (TRUE) : $pageHeaderOptionFields .= " " . getLngt("Suchen") . " \n"; $pageHeaderOptionFields .= "    |    \n"; $pageHeaderOptionFields .= "" . getLngt("Felder zurücksetzen") . "\n"; $pageHeaderOptionFields .= "    |    \n"; $pageHeaderOptionFields .= getLngt("Option:") . "  \n"; $pageHeaderOptionFields .= " " . getLngt("Präfix") . "\n"; $pageHeaderOptionFields .= " " . getLngt("Teilwort") . "\n"; $pageHeaderOptionFields .= "

\n"; $pageHeaderOptionFields .= getLngt("Ausgeblendete anzeigen") . " \n"; $pageHeaderOptionFields .= "\n"; // $pageHeaderOptionFields .= "    |    \n"; $pageHeaderOptionFields .= "


\n"; endif; // OUTPUT: Table header search fields $tableHeaderSearchFields = ""; if (TRUE) : $dspColHeaderSearchFieldArray["cmp_comp"] = ""; $dspColHeaderSearchFieldArray["cmp_comp2"] = ""; $dspColHeaderSearchFieldArray["cs_eid"] = ""; $dspColHeaderSearchFieldArray["cmp_match"] = ""; $dspColHeaderSearchFieldArray["cmp_authenticated_img"] = " " . getLngt("Suchen") . " "; $dspColHeaderSearchFieldArray["usr_name"] = ""; $dspColHeaderSearchFieldArray["usr_phone"] = ""; $dspColHeaderSearchFieldArray["usr_email"] = ""; $dspColHeaderSearchFieldArray["ad_street"] = ""; $dspColHeaderSearchFieldArray["cmp_hsno"] = ""; $dspColHeaderSearchFieldArray["ad_zipcode"] = ""; $dspColHeaderSearchFieldArray["ad_city"] = ""; $dspColHeaderSearchFieldArray["cmp_remark"] = ""; $tmpKeys = array_keys($dspColHeaderSearchFieldArray); for ($i = 0; $i < $displayedListColsArrayLen; $i++) { // Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index) $j = array_search($displayedListColsArray[$i], $tmpKeys); if (!($j === FALSE)) : // Define length (html attribute "size") of the field and substitute macro if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") : $dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", "", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]); else : $dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", " size=\"" . $displayedListLenColsArray[$i] . "\" ", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]); endif; $cellColor = getListColor(1, 1); $tableHeaderSearchFields .= "" . $dspColHeaderSearchFieldArray[$tmpKeys[$j]] . ""; endif; } endif; // OUTPUT: Table header column links $tableHeaderLinks = ""; if (TRUE) : $dspColHeaderLinksArray = array(); $dspColHeaderLinksArray["cmp_comp"] = " " . getLngt("Firma") . " "; $dspColHeaderLinksArray["cmp_comp2"] = " " . getLngt("Firma2") . " "; $dspColHeaderLinksArray["cs_eid"] = " " . getLngt("ExtID") . " "; $dspColHeaderLinksArray["cmp_match"] = " " . getLngt("Freitext") . " "; $dspColHeaderLinksArray["cmp_authenticated_img"] = " " . getLngt("Freigabe") . " "; $dspColHeaderLinksArray["usr_name"] = " " . getLngt("Admin-Name") . ""; $dspColHeaderLinksArray["usr_phone"] = " " . getLngt("Admin-Telefon") . ""; $dspColHeaderLinksArray["usr_email"] = " " . getLngt("Admin-Email") . ""; $dspColHeaderLinksArray["ad_street"] = " " . getLngt("Straße") . ""; $dspColHeaderLinksArray["cmp_hsno"] = " " . getLngt("Hausnr.") . ""; $dspColHeaderLinksArray["ad_zipcode"] = " " . getLngt("PLZ") . ""; $dspColHeaderLinksArray["ad_city"] = " " . getLngt("Ort") . ""; $dspColHeaderLinksArray["cmp_remark"] = " " . getLngt("Bemerkung") . ""; $tmpKeys = array_keys($dspColHeaderLinksArray); for ($i = 0; $i < $displayedListColsArrayLen; $i++) { // Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index) $j = array_search($displayedListColsArray[$i], $tmpKeys); if (!($j === FALSE)) : $cellColor = getListColor(0, 0); $tableHeaderLinks .= "" . $dspColHeaderLinksArray[$tmpKeys[$j]] . ""; endif; } endif; // if called e.g. by the first time with empty search-fields $searchValues = $f_cmp_comp . $f_cmp_comp2 . $f_cmp_match . $f_cs_eid . $f_street . $f_hsno . $f_zipcode . $f_city . $f_country . $f_remark . $f_usr_phone; // Generate search-resultset if ($f_act == "search" && $searchValues != "") : if (strlen($f_cmp_comp) > 2 || strlen($f_cmp_comp2) > 2 || strlen($f_cmp_match) > 2 || strlen($f_cs_eid) > 2 || strlen($f_street) > 2 || strlen($f_hsno) > 0 || strlen($f_zipcode) > 2 || strlen($f_city) > 2 || strlen($f_remark) > 2 || strlen($f_usr_phone) > 2) : // ******************************************* // * Selection of the customers for the list * // ******************************************* if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif; $whereClause = ""; // Check for search value in pt.pt_cmp_comp OR pt.pt_cmp_match if ($f_cmp_comp != "") : $whereClause .= "pt.pt_cmp_comp LIKE '" . $prefix . $f_cmp_comp . "%'"; if (($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match != "") || ($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid != "") || ($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone != "")) : $whereClause = " (" . $whereClause; if ($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match != "") : $whereClause .= " OR pt.pt_cmp_match LIKE '" . $prefix . $f_cmp_match . "%'"; endif; if ($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid != "") : $whereClause .= " OR pt.pt_cs_eid LIKE '" . $prefix . $f_cs_eid . "%'"; endif; if ($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone != "") : $whereClause .= " OR pt.pt_usr_phone LIKE '" . $prefix . $f_usr_phone . "%'"; endif; $whereClause .= ") "; endif; endif; if ($whereClause != "" && $f_cmp_comp2 != "") : $whereClause .= " AND "; endif; if ($f_cmp_comp2 != "") : $whereClause .= "pt.pt_cmp_comp2 LIKE '" . $prefix . $f_cmp_comp2 . "%'"; endif; // Check for search value in pt.pt_cmp_comp OR pt.pt_cmp_match if ($constSearchPtlistCmpcompCmpmatch != "1") : if ($whereClause != "" && $f_cmp_match != "") : $whereClause .= " AND "; endif; if ($f_cmp_match != "") : $whereClause .= "pt.pt_cmp_match LIKE '" . $prefix . $f_cmp_match . "%'"; endif; endif; // Check for search value in pt.pt_cmp_comp OR pt.pt_cs_eid if ($constSearchPtlistCmpcompCseid != "1") : if ($whereClause != "" && $f_cs_eid != "") : $whereClause .= " AND "; endif; if ($f_cs_eid != "") : $whereClause .= "pt.pt_cs_eid LIKE '" . $prefix . $f_cs_eid . "%'"; endif; endif; // Check for search value in pt.pt_cmp_comp OR pt.pt_usr_phone if ($constSearchPtlistCmpcompCscadphone != "1") : if ($whereClause != "" && $f_usr_phone != "") : $whereClause .= " AND "; endif; if ($f_usr_phone != "") : $whereClause .= "pt.pt_usr_phone LIKE '" . $prefix . $f_usr_phone . "%'"; endif; endif; if ($whereClause != "" && $f_usr_name != "") : $whereClause .= " AND "; endif; if ($f_usr_name != "") : $whereClause .= "pt.pt_usr_name LIKE '" . $prefix . $f_usr_name . "%'"; endif; if ($whereClause != "" && $f_usr_email != "") : $whereClause .= " AND "; endif; if ($f_usr_email != "") : $whereClause .= "pt.pt_usr_email LIKE '" . $prefix . $f_usr_email . "%'"; endif; // if ($whereClause != "" && $f_cmp_iln != "") : $whereClause .= " AND "; endif; // if ($f_cmp_iln != "") : $whereClause .= "pt.pt_cmp_iln LIKE '" . $prefix . $f_cmp_iln . "%'"; endif; // if ($whereClause != "" && $f_cmp_tax_idno != "") : $whereClause .= " AND "; endif; // if ($f_cmp_tax_idno != "") : $whereClause .= "pt.pt_cmp_tax_idno LIKE '" . $prefix . $f_cmp_tax_idno . "%'"; endif; // if ($whereClause != "" && $f_cmp_bank != "") : $whereClause .= " AND "; endif; // if ($f_cmp_bank != "") : $whereClause .= "pt.pt_cmp_bank LIKE '" . $prefix . $f_cmp_bank . "%'"; endif; // if ($whereClause != "" && $f_cmp_bankno != "") : $whereClause .= " AND "; endif; // if ($f_cmp_bankno != "") : $whereClause .= "pt.pt_cmp_bankno LIKE '" . $prefix . $f_cmp_bankno . "%'"; endif; // if ($whereClause != "" && $f_cmp_bankacc != "") : $whereClause .= " AND "; endif; // if ($f_cmp_bankacc != "") : $whereClause .= "pt.pt_cmp_bankacc LIKE '" . $prefix . $f_cmp_bankacc . "%'"; endif; if ($whereClause != "" && $f_street != "") : $whereClause .= " AND "; endif; if ($f_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_street . "%'"; endif; if ($whereClause != "" && $f_hsno != "") : $whereClause .= " AND "; endif; if ($f_hsno != "") : $whereClause .= "pt.pt_cmp_hsno LIKE '" . $f_hsno . "%'"; endif; if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif; if ($f_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_zipcode . "%'"; endif; if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif; if ($f_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_city . "%'"; endif; if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif; if ($f_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_country . "%'"; endif; if ($whereClause != "" && $f_remark != "") : $whereClause .= " AND "; endif; if ($f_remark != "") : $whereClause .= "pt.pt_cmp_remark LIKE '" . $f_remark . "%'"; endif; // Check authentication // Enable again 4 cashMode (... damit die "eigentliche" Funktion des Sperrens wieder aufgenommen werden kann !!!!!!!!!!!!!!!!!!) // if ($whereClause != "" && $f_cmp_authenticated == "1") : $whereClause .= " AND "; endif; // if ($f_cmp_authenticated == "1") : $whereClause .= "cmp.cmp_authenticated LIKE '" . $f_cmp_authenticated . "%'"; endif; // Show "invisible" prospects if ($f_show_invisible != "1") : if ($whereClause != "") : $whereClause .= " AND "; endif; $whereClause .= " pt.pt_cmp_visible = '1'"; endif; if ($whereClause != "") : $whereClause .= " AND "; endif; if ($orderClause == "") : $orderClause = "pt.pt_cmp_comp"; endif; $sqlquery = "SELECT pt.pt_id, pt.pt_cs_eid, pt.pt_cs_commission_no, pt.pt_cs_discount, pt.pt_cs_fixprice_discount, " . " pt.pt_cmp_comp, pt.pt_cmp_comp2, pt.pt_cmp_authenticated, pt.pt_cmp_remark, pt.pt_cmp_match, pt.pt_cmp_cashmode," . " pt.tx_id, pt.ad_id, pt.pt_cmp_hsno,pt.pt_usr_phone," . " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country" . " FROM prospect AS pt, address AS ad" . " WHERE " .$whereClause . " pt.hq_id IN " . getSQLMandatorArray($f_hq_id) . " AND" . " pt.ad_id = ad.ad_id" . " ORDER BY " . $orderClause; // echo $sqlquery . "
"; getDb2Connection(); // Try to connect request server because of performance $result = $db2->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: '$sqlquery': " . $result->getMessage()); // Table with header $rowCounter = 0; $lineToggler = 0; while ($row = $result->fetch_assoc()): $numOfRows++; $dspColArray = array(); $tableOfRows .= ""; // $dspColArray["cmp_comp"] = " __START__" . $row["pt_cmp_comp"] . "__END__"; $dspColArray["cmp_comp"] = " __START__" . my_str_check_html($row["pt_cmp_comp"]) . "__END__"; $dspColArray["cmp_comp2"] = " __START__" . $row["pt_cmp_comp2"] . "__END__"; $dspColArray["cs_eid"] = " __START__" . $row["pt_cs_eid"] . "__END__"; $dspColArray["cmp_match"] = " __START__" . $row["cmp_match"] . "__END__"; $authImgName = "circle_red.png"; if ($row["pt_cmp_authenticated"] == "1") : $authImgName = "circle_green.png"; endif; $dspColArray["cmp_authenticated_img"] = ""; $cashmodeImgName = "circle_green.png"; if ($row["pt_cmp_cashmode"] == "1") : $cashmodeImgName = "circle_red.png"; endif; // Enable 4 cashMode // $dspColArray["usr_name"] = ""; $dspColArray["usr_name"] = " __START__" . $row["pt_usr_name"] . "__END__"; $dspColArray["usr_phone"] = " __START__" . $row["pt_usr_phone"] . "__END__"; $dspColArray["usr_email"] = " __START__" . $row["pt_usr_email"] . "__END__"; $dspColArray["ad_street"] = " __START__" . $row["ad_street"] . "__END__"; $dspColArray["cmp_hsno"] = " __START__" . $row["pt_cmp_hsno"] . "__END__"; $dspColArray["ad_zipcode"] = " __START__" . $row["ad_zipcode"] . "__END__"; $dspColArray["ad_city"] = " __START__" . $row["ad_city"] . "__END__"; $dspColArray["cmp_remark"] = " __START__" . $row["pt_cmp_remark"] . "__END__"; // Generate list $rowCounter++; $tmpKeys = array_keys($dspColArray); for ($i = 0; $i < $displayedListColsArrayLen; $i++) { // Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index) $j = array_search($displayedListColsArray[$i], $tmpKeys); if (!($j === FALSE)) : // Define length (html attribute "size") of the field and substitute macro if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") : $dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]); $dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]); else : // content of db-fields $tagBegin = "__START__"; $tagEnd = "__END__"; if (!(strpos($dspColArray[$tmpKeys[$j]], $tagBegin) === FALSE) && !(strpos($dspColArray[$tmpKeys[$j]], $tagEnd) === FALSE)) : $pos0 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin); // begin of tagBegin (first occurrence) $pos1 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin) + strlen($tagBegin); // end of tagBegin (first occurrence) $pos2 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd); // begin of tagEnd (first occurrence) $pos3 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd) + strlen($tagEnd); // end of tagEnd (first occurrence) if ($pos2 - $pos1 > 0) : // first get the content of the tag $fieldContent = substr($dspColArray[$tmpKeys[$j]], $pos1, $pos2 - $pos1); $fieldContent = substr($fieldContent, 0, $displayedListLenColsArray[$i]); // replace original content with string-content $dspColArray[$tmpKeys[$j]] = substr_replace($dspColArray[$tmpKeys[$j]], $fieldContent, $pos0, $pos3 - $pos0); endif; endif; endif; if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif; $cellColor = getListColor($rowCounter, $lineToggler); $dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]); $dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]); $dspColArray[$tmpKeys[$j]] = str_replace("__BGCOL__", " bgcolor=\"" . $cellColor ."\"", $dspColArray[$tmpKeys[$j]]); $tableOfRows .= $dspColArray[$tmpKeys[$j]] . "\n"; endif; } if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif; $tableOfRows .= "\n"; endwhile; $result->free(); else : $statusMessage = getLngt("Bei Eingabe weniger als 3 Zeichen in mindestens einem Feld erfolgt keine Suche!"); endif; endif; ?> <?php echo $pageTitel ?>