🎨 cleanup code

This commit is contained in:
Eric
2020-02-12 15:00:10 +01:00
parent 03834fedb8
commit 6f04525cdf
2 changed files with 36 additions and 26 deletions

View File

@@ -28,9 +28,12 @@ require_once(APPROOT.'/application/csvpage.class.inc.php');
/**
* Determines if the name of the field to be mapped correspond
* to the name of an external key or an Id of the given class
*
* @param string $sClassName The name of the class
* @param string $sFieldCode The attribute code of the field , or empty if no match
*
* @return bool true if the field corresponds to an id/External key, false otherwise
* @throws \Exception
*/
function IsIdField($sClassName, $sFieldCode)
{
@@ -52,10 +55,13 @@ function IsIdField($sClassName, $sFieldCode)
/**
* Get all the fields xxx->yyy based on the field xxx which is an external key
* @param string $sExtKeyAttCode Attribute code of the external key
*
* @param $sAttCode
* @param AttributeDefinition $oExtKeyAttDef Attribute definition of the external key
* @param bool $bAdvanced True if advanced mode
* @return Ash List of codes=>display name: xxx->yyy where yyy are the reconciliation keys for the object xxx
*
* @return array List of codes=>display name: xxx->yyy where yyy are the reconciliation keys for the object xxx
* @throws \CoreException
*/
function GetMappingsForExtKey($sAttCode, AttributeDefinition $oExtKeyAttDef, $bAdvanced)
{
@@ -88,12 +94,15 @@ function GetMappingsForExtKey($sAttCode, AttributeDefinition $oExtKeyAttDef, $bA
* If not in advanced mode, all "id" fields (id and external keys) must be mapped to ":none:" (i.e -- ignore this field --)
* External fields that do not correspond to a reconciliation key must be mapped to ":none:"
* Otherwise, if a field equals either the 'code' or the 'label' (translated) of a field, then it's mapped automatically
*
* @param string $sClassName Name of the class used for the mapping
* @param string $sFieldName Name of the field, as it comes from the data file (header line)
* @param integer $iFieldIndex Number of the field in the sequence
* @param bool $bAdvancedMode Whether or not advanced mode was chosen
* @param string $sDefaultChoice If set, this will be the item selected by default
*
* @return string The HTML code corresponding to the drop-down list for this field
* @throws \CoreException
*/
function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMode, $sDefaultChoice)
{
@@ -213,7 +222,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
$sSelected = ' selected';
}
$sHtml .= "<option value=\"$sAttCode\"$sSelected>$sLabel</option>\n";
$sHtml .= "<option value=\"$sAttCode\" $sSelected>$sLabel</option>\n";
}
$sHtml .= "</select>\n";
return $sHtml;