Skip to content

Commit

Permalink
Merge branch 'pu/ccheng/mw_3198' into 'main'
Browse files Browse the repository at this point in the history
fix(HumanResources/Export): export empployee with custom fields

See merge request tine20/tine20!6598
  • Loading branch information
pschuele committed Feb 25, 2025
2 parents ee164ed + 3ea51f5 commit ea6fab6
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 110 deletions.
32 changes: 0 additions & 32 deletions tine20/HumanResources/Export/Xls.php

This file was deleted.

163 changes: 163 additions & 0 deletions tine20/HumanResources/Export/definitions/hr_default_newcsv.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<model>HumanResources_Model_Employee</model>
<name>hr_default_newcsv</name>
<label>CSV list with custom fields</label>
<type>export</type>
<plugin>Tinebase_Export_CsvNew</plugin>
<description>default csv employee export definition with custom fields</description>
<favorite>true</favorite>
<customFields>1</customFields>
<header>1</header>
<sort>
<field>number</field>
<direction>ASC</direction>
</sort>
<columns>
<column>
<identifier>number</identifier>
<header>Number</header>
</column>
<column>
<identifier>account_id</identifier>
<header>Account</header>
</column>
<column>
<identifier>description</identifier>
<header>Description</header>
</column>
<column>
<identifier>countryname</identifier>
<header>Country</header>
</column>
<column>
<identifier>locality</identifier>
<header>Locality</header>
</column>
<column>
<identifier>postalcode</identifier>
<header>Postalcode</header>
</column>
<column>
<identifier>region</identifier>
<header>Region</header>
</column>
<column>
<identifier>street</identifier>
<header>Street</header>
</column>
<column>
<identifier>street2</identifier>
<header>Street 2</header>
</column>
<column>
<identifier>email</identifier>
<header>E-Mail</header>
</column>
<column>
<identifier>tel_home</identifier>
<header>Telephone Number</header>
</column>
<column>
<identifier>tel_cell</identifier>
<header>Cell Phone Number</header>
</column>
<column>
<identifier>title</identifier>
<header>Title</header>
</column>
<column>
<identifier>salutation</identifier>
<header>Salutation</header>
</column>
<column>
<identifier>n_family</identifier>
<header>Last Name</header>
</column>
<column>
<identifier>n_given</identifier>
<header>First Name</header>
</column>
<column>
<identifier>n_fn</identifier>
<header>Employee name</header>
</column>
<column>
<identifier>bday</identifier>
<header>Birthday</header>
</column>
<column>
<identifier>bank_account_holder</identifier>
<header>Account Holder</header>
</column>
<column>
<identifier>bank_account_number</identifier>
<header>Account Number</header>
</column>
<column>
<identifier>iban</identifier>
<header>IBAN</header>
</column>
<column>
<identifier>bic</identifier>
<header>BIC</header>
</column>
<column>
<identifier>bank_name</identifier>
<header>Bank Name</header>
</column>
<column>
<identifier>bank_code_number</identifier>
<header>Code Number</header>
</column>
<column>
<identifier>employment_begin</identifier>
<header>Employment begin</header>
</column>
<column>
<identifier>employment_end</identifier>
<header>Employment end</header>
</column>
<column>
<identifier>supervisor_id</identifier>
<header>Supervisor</header>
</column>
<column>
<identifier>division_id</identifier>
<header>Division</header>
</column>
<column>
<identifier>health_insurance</identifier>
<header>Health Insurance</header>
</column>
<column>
<identifier>profession</identifier>
<header>Profession</header>
</column>
<column>
<identifier>position</identifier>
<header>Position</header>
</column>
<column>
<identifier>created_by</identifier>
<header>Created By</header>
</column>
<column>
<identifier>creation_time</identifier>
<header>Creation Time</header>
</column>
<column>
<identifier>last_modified_by</identifier>
<header>Last Modified By</header>
</column>
<column>
<identifier>last_modified_time</identifier>
<header>Last Modified Time</header>
</column>
<column>
<identifier>tags</identifier>
<header>Tags</header>
<type>tags</type>
</column>
</columns>
</config>
55 changes: 0 additions & 55 deletions tine20/HumanResources/Export/definitions/hr_default_xls.xml

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions tine20/HumanResources/translations/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ msgstr "Nicht erlaubt!"
msgid "It's only allowed to book remaining vacation days from years in the past!"
msgstr "Es ist nur erlaubt, Resturlaub aus vergangenen Jahren zu buchen!"

msgid "Excel current columns"
msgstr "Excel angezeigte Spalten"

msgid "Monthly Report (Clock Times)"
msgstr "Monatsbericht (Stempelzeiten)"

Expand Down Expand Up @@ -1288,3 +1285,6 @@ msgstr "Sonderzahlung"

msgid "[H] Short Business trip"
msgstr "[Z] Kurze Dienstreise"

#~ msgid "Excel current columns"
#~ msgstr "Excel angezeigte Spalten"
3 changes: 0 additions & 3 deletions tine20/HumanResources/translations/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ msgstr "Not allowed!"
msgid "It's only allowed to book remaining vacation days from years in the past!"
msgstr "It's only allowed to book remaining vacation days from years in the past!"

msgid "Excel current columns"
msgstr "Excel current columns"

msgid "Monthly Report (Clock Times)"
msgstr "Monthly Report (Clock Times)"

Expand Down
3 changes: 0 additions & 3 deletions tine20/HumanResources/translations/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ msgstr ""
msgid "It's only allowed to book remaining vacation days from years in the past!"
msgstr ""

msgid "Excel current columns"
msgstr ""

msgid "Monthly Report (Clock Times)"
msgstr ""

Expand Down
21 changes: 21 additions & 0 deletions tine20/Tinebase/Export/CsvNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,27 @@ protected function _startRow()

protected function _endRow()
{
if ($this->_config->columns && $this->_config->customFields) {
$record = new $this->_modelName(array(), true);

$this->_fields = $record->getFields();
$this->_fields = array_unique(array_merge(
array_diff($this->_fields, ['customfields']),
array_keys($this->_expandCustomFields)
));

foreach ($this->_expandCustomFields as $key => $value) {
if ($this->_currentRowType === self::ROW_TYPE_GENERIC_HEADER) {
$name = $this->_translate->_($value);
$this->_writeValue($name);
}
if ($this->_currentRowType === self::ROW_TYPE_RECORD) {
$record = $this->_currentRecord;
$this->_writeValue($this->_convertToString($record->{$key}));
}
}
}

if (false === self::fputcsv($this->_filehandle, $this->_currentRow, $this->_delimiter, $this->_enclosure,
$this->_escape_char, $this->_charset)) {
throw new Tinebase_Exception_Backend('could not write current row to csv stream');
Expand Down

0 comments on commit ea6fab6

Please sign in to comment.