made physicalDeliveryOfficeName multi-value

This commit is contained in:
Roland Gruber 2012-03-20 20:30:35 +00:00
parent 4cd4af88f5
commit 4df8ace92d
1 changed files with 44 additions and 8 deletions

View File

@ -503,8 +503,8 @@ class inetOrgPerson extends baseModule implements passwordService {
$return['upload_columns'][] = array( $return['upload_columns'][] = array(
'name' => 'inetOrgPerson_physicalDeliveryOfficeName', 'name' => 'inetOrgPerson_physicalDeliveryOfficeName',
'description' => _('Office name'), 'description' => _('Office name'),
'help' => 'physicalDeliveryOfficeName', 'help' => 'physicalDeliveryOfficeNameList',
'example' => _('YourCompany, Human Resources') 'example' => _('YourCompany')
); );
} }
// available PDF fields // available PDF fields
@ -749,6 +749,10 @@ class inetOrgPerson extends baseModule implements passwordService {
"Headline" => _("Office name"), 'attr' => 'physicalDeliveryOfficeName', "Headline" => _("Office name"), 'attr' => 'physicalDeliveryOfficeName',
"Text" => _("The office name of the user (e.g. YourCompany, Human Resources).") "Text" => _("The office name of the user (e.g. YourCompany, Human Resources).")
), ),
'physicalDeliveryOfficeNameList' => array(
"Headline" => _("Office name"), 'attr' => 'physicalDeliveryOfficeName',
"Text" => _("The office name of the user (e.g. YourCompany, Human Resources).") . ' ' . _("Multiple values are separated by semicolon.")
),
'departmentNumber' => array( 'departmentNumber' => array(
"Headline" => _("Department"), 'attr' => 'departmentNumber', "Headline" => _("Department"), 'attr' => 'departmentNumber',
"Text" => _("Here you can enter the user's department.") "Text" => _("Here you can enter the user's department.")
@ -1114,7 +1118,18 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->attributes['carLicense'][0] = $_POST['carLicense']; $this->attributes['carLicense'][0] = $_POST['carLicense'];
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) {
$this->attributes['physicalDeliveryOfficeName'][0] = $_POST['physicalDeliveryOfficeName']; $physicalDeliveryOfficeNameCounter = 0;
while (isset($_POST['physicalDeliveryOfficeName' . $physicalDeliveryOfficeNameCounter])) {
$this->attributes['physicalDeliveryOfficeName'][$physicalDeliveryOfficeNameCounter] = $_POST['physicalDeliveryOfficeName' . $physicalDeliveryOfficeNameCounter];
if ($this->attributes['physicalDeliveryOfficeName'][$physicalDeliveryOfficeNameCounter] == '') {
unset($this->attributes['physicalDeliveryOfficeName'][$physicalDeliveryOfficeNameCounter]);
}
$physicalDeliveryOfficeNameCounter++;
}
if (isset($_POST['addPhysicalDeliveryOfficeName'])) {
$this->attributes['physicalDeliveryOfficeName'][] = '';
}
$this->attributes['physicalDeliveryOfficeName'] = array_values($this->attributes['physicalDeliveryOfficeName']);
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
$departmentNumberCounter = 0; $departmentNumberCounter = 0;
@ -1457,9 +1472,30 @@ class inetOrgPerson extends baseModule implements passwordService {
$fieldContainer->addElement($registeredAddressHelp, true); $fieldContainer->addElement($registeredAddressHelp, true);
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOfficeName')) {
$physicalDeliveryOfficeName = ''; $physicalDeliveryOfficeNames = array();
if (isset($this->attributes['physicalDeliveryOfficeName'][0])) $physicalDeliveryOfficeName = $this->attributes['physicalDeliveryOfficeName'][0]; if (isset($this->attributes['physicalDeliveryOfficeName'][0])) {
$fieldContainer->addElement(new htmlTableExtendedInputField(_('Office name'), 'physicalDeliveryOfficeName', $physicalDeliveryOfficeName, 'physicalDeliveryOfficeName'), true); $physicalDeliveryOfficeNames = $this->attributes['physicalDeliveryOfficeName'];
}
if (sizeof($physicalDeliveryOfficeNames) == 0) {
$physicalDeliveryOfficeNames[] = '';
}
$physicalDeliveryOfficeNameLabel = new htmlOutputText(_('Office name'));
$physicalDeliveryOfficeNameLabel->alignment = htmlElement::ALIGN_TOP;
$fieldContainer->addElement($physicalDeliveryOfficeNameLabel);
$physicalDeliveryOfficeNameContainer = new htmlGroup();
for ($i = 0; $i < sizeof($physicalDeliveryOfficeNames); $i++) {
$physicalDeliveryOfficeNameContainer->addElement(new htmlInputField('physicalDeliveryOfficeName' . $i, $physicalDeliveryOfficeNames[$i]));
if ($i < (sizeof($physicalDeliveryOfficeNames) - 1)) {
$physicalDeliveryOfficeNameContainer->addElement(new htmlOutputText('<br>', false));
}
else {
$physicalDeliveryOfficeNameContainer->addElement(new htmlButton('addPhysicalDeliveryOfficeName', 'add.png', true));
}
}
$fieldContainer->addElement($physicalDeliveryOfficeNameContainer);
$physicalDeliveryOfficeNameHelp = new htmlHelpLink('physicalDeliveryOfficeName');
$physicalDeliveryOfficeNameHelp->alignment = htmlElement::ALIGN_TOP;
$fieldContainer->addElement($physicalDeliveryOfficeNameHelp, true);
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) {
$roomNumber = ''; $roomNumber = '';
@ -1991,7 +2027,7 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
$physicalDeliveryOfficeName = ''; $physicalDeliveryOfficeName = '';
if (isset($this->attributes['physicalDeliveryOfficeName'][0])) { if (isset($this->attributes['physicalDeliveryOfficeName'][0])) {
$physicalDeliveryOfficeName = $this->attributes['physicalDeliveryOfficeName'][0]; $physicalDeliveryOfficeName = implode(', ', $this->attributes['physicalDeliveryOfficeName']);
} }
$employeeType = ''; $employeeType = '';
if (isset($this->attributes['employeeType'][0])) $employeeType = $this->attributes['employeeType'][0]; if (isset($this->attributes['employeeType'][0])) $employeeType = $this->attributes['employeeType'][0];
@ -2322,7 +2358,7 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
// physicalDeliveryOfficeName // physicalDeliveryOfficeName
if ($rawAccounts[$i][$ids['inetOrgPerson_physicalDeliveryOfficeName']] != "") { if ($rawAccounts[$i][$ids['inetOrgPerson_physicalDeliveryOfficeName']] != "") {
$partialAccounts[$i]['physicalDeliveryOfficeName'] = $rawAccounts[$i][$ids['inetOrgPerson_physicalDeliveryOfficeName']]; $partialAccounts[$i]['physicalDeliveryOfficeName'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_physicalDeliveryOfficeName']]);
} }
// carLicense // carLicense
if ($rawAccounts[$i][$ids['inetOrgPerson_carLicense']] != "") { if ($rawAccounts[$i][$ids['inetOrgPerson_carLicense']] != "") {