Skip to content

Commit

Permalink
Fixed two problems, one with a missing $pge an one with empty C eleme…
Browse files Browse the repository at this point in the history
…nts that garbled the reorder array and thereby the export functionality.
  • Loading branch information
Marc-Oliver Pahl committed Mar 12, 2019
1 parent 870b09e commit 0c5ec32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/XIlib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function createIdMapping(&$labElementArray)
// remove stared values as they describe not existing elements:
$labElementArray = array_filter($labElementArray, 'notStared');
$labElementArray = array_flip($labElementArray); // exchange keys and values (+ remove duplicate elements...)
$lastSeenElement = '';
$elementCounter = 99;
$lastSeenElement = null;
$elementCounter = 12345;
foreach ($labElementArray as $key => $value) {
if ($lastSeenElement != $key[0]) { // new element ID
$lastSeenElement = $key[0];
Expand Down Expand Up @@ -716,7 +716,7 @@ function notStared($value)
*/
function processElement(&$element, &$mappingArray, $labNumber, $isImport = false)
{
global $usr;
global $usr,$pge;
// Remove versioning links from history...
$element->history = preg_replace('/^@@([\d]*) (.*)/m', '$2', $element->history);
switch ($element->elementId) {
Expand Down
6 changes: 3 additions & 3 deletions pages/XIport.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@
(($labToExport->lab->idx != 1)?'c'.$labToExport->lab->idx.' '.$labToExport->lab->buildStructure(true, true).' ':'') // 1 means empty
).'l'.$key
);

// remove empty entries (that occur with empty collections!)
$labElementArray = array_filter( $labElementArray, 'strlen' );
// build the array that contains the renaming: [oldID] => exportedID
createIdMapping( $labElementArray );

// Needed in some XIlib functions.

// TO-DO quick fix for empty UniqueID, needs better fix
Expand Down Expand Up @@ -287,7 +287,7 @@
$serializedElements[0]=$nextElement->getSerialized(); //set l Element as array item with key 0; easier to decode labname for getLabsFromDirectory function
break;
default:
$serializedElements[$k++]=$nextElement->getSerialized(); //Appends the element to the array
$serializedElements[$k++]=$nextElement->getSerialized(); //Appends the element to the array
}

} // /foreach
Expand Down

0 comments on commit 0c5ec32

Please sign in to comment.