"; // $output .= " "; for ($i = 0; $i < $numOfLists; $i++) : $output .= " "; endfor; $output .= ""; // Display delivery reasons $outputReasons = ""; $outputText = ""; if ($f_service != "" && $objType != "" && $objId != "") : // Set special database fieldname regarding the generic data container structure $specialDbFieldNameReasons = "service_delivery_reasons"; $specialDbFieldNameMailState = "service_delivery_reasons_mail_state"; $specialDbFieldNameText = "service_delivery_reasons_text"; // Save reasons if ($f_act == "saveCustomerServicesDeliveryReasons") : // **** Reasons **** // Load current reasons of the customer $gdcContentReasons = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'"); $currArray = getKeyValueArrayFromString($gdcContentReasons); // Convert key-value-string to array $currArray[$f_service] = implode("§", $f_reason_array); // Implode new reasons of the selected service and store to current structure // Get new string of ALL services to store into the database $newContentArray = array(); for ($i = 0; $i < $numOfLists; $i++) : if ($currArray[$i] != "") : $newContentArray[] = $i . "=" . $currArray[$i]; endif; endfor; $gdcContentReasons = implode("|", $newContentArray); // Update or insert reasons if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameReasons))) : updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentReasons),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameReasons, "gdc_content", $gdcContentReasons)); endif; // **** Mail state for reasons **** /* // Load current mail states of the customer $gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'"); $currArray = getKeyValueArrayFromString($gdcContentMails); // Convert key-value-string to array $currArray[$f_service] = implode("§", $f_mail_array); // Implode new reasons of the selected service and store to current structure // Get new string of ALL services to store into the database $newContentArray = array(); for ($i = 0; $i < $numOfLists; $i++) : if ($currArray[$i] != "") : $newContentArray[] = $i . "=" . $currArray[$i]; endif; endfor; $gdcContentReasons = implode("|", $newContentArray); // Update or insert reasons if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameMailState))) : updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentReasons),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameMailState, "gdc_content", $gdcContentReasons)); endif; */ // **** Text **** /* $gdcContentTexts = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'"); $currArray = getKeyValueArrayFromString($gdcContentTexts); // Convert key-value-string to array $currArray[$f_service] = $f_text; // Implode new text of the selected service and store to current structure // Get new string of ALL services to store into the database $newContentArray = array(); for ($i = 0; $i < $numOfLists; $i++) : if ($currArray[$i] != "") : $newContentArray[] = $i . "=" . $currArray[$i]; endif; endfor; $gdcContentTexts = implode("|", $newContentArray); // Update or insert text if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameText))) : updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentTexts),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'"); else : insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameText, "gdc_content", $gdcContentTexts)); endif; */ endif; // **** Prepare output reasons **** // (Re-)Load current reasons and mail states of the customer $gdcContentReasons = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'"); $gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'"); $i = ""; // Init $outputReasons .= "\n"; $outputReasons .= "\n"; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; // $outputReasons .= ""; $outputReasons .= "\n"; if ($gdcContentReasons != "") : // Split content to get the reasons of the current selected service // E.g.: "1=R1§R2§R3|2=R1§R2§R3§R4§R5|3=R1..." => x(0) = R1§R2§R3, x(1) = R1,R2,R3,R4,R5, ... // [=> 1=R1,R2,R3 => List "1" is mapped to the reasons] $f_reason_array = getKeyValueArrayFromString($gdcContentReasons); $f_reason_string = $f_reason_array[$f_service]; // Take the reasons (array) of the current service // $f_mail_array = getKeyValueArrayFromString($gdcContentMails); // $f_mail_string = $f_mail_array[$f_service]; // Take the mail states (array) of the reasons of the current service if ($f_reason_string != "") : $f_reason_array = explode("§", $f_reason_string); $f_reason_array_len = count($f_reason_array); // $f_mail_array = explode("§", $f_mail_string); // $f_f_mail_array_len = count($f_mail_array); if ($f_reason_array_len > 0) : for ($i = 0; $i < $f_reason_array_len; $i++) : $tmpVal = explode("$", $f_reason_array[$i]); $reasonCode = $tmpVal[0]; $reasonText = $tmpVal[1]; $outputReasons .= "\n"; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; /* $outputReasons .= ""; */ $outputReasons .= "\n"; endfor; endif; endif; endif; if ($i == "") : $i = 1; else : $i++; endif; $outputReasons .= "\n"; $outputReasons .= "\n"; $outputReasons .= "\n"; $outputReasons .= "\n"; /* $outputReasons .= "\n"; $outputReasons .= "
" . getLngt("Lfd.") . " " . getLngt("Code") . " " . getLngt("Text") . " " . getLngt("Mail-Status") . "
" . ($i + 1) . ". "; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= "
" . $i . ". \n"; $outputReasons .= ""; $outputReasons .= "\n"; $outputReasons .= ""; $outputReasons .= ""; $outputReasons .= ""; */ $outputReasons .= "
\n"; // **** Prepare output text **** // (Re-)Load current text of the customer $gdcContentText = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'"); $f_text_array = getKeyValueArrayFromString($gdcContentText); $f_text = $f_text_array[$f_service]; // Take the text of the current service $outputText .= ""; $outputText .= " "; $outputText .= " "; $outputText .= " "; $outputText .= "
"; $outputText .= " "; $outputText .= "
"; endif; // Only for output if ($objId != "" && ($objType == "cs" || $objType == "cr")) : $cmpId = getFieldValueFromId("customer", "cs_id", $objId, "cmp_id"); $tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2")); $title = $tmpFields[0] . " " . $tmpFields[1]; endif; ?> <?php echo $pageTitel ?>