Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to overwrite with skeletal file #671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions classes/SpecUploadBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SpecUploadBase extends SpecUpload{
private $matchCatalogNumber = 1;
private $matchOtherCatalogNumbers = 0;
private $versionDataEdits = false;
private $overwriteData = false;
private $verifyImageUrls = false;
private $processingStatus = '';
protected $nfnIdentifier;
Expand Down Expand Up @@ -918,7 +919,14 @@ protected function transferOccurrences(){
$sqlFragArr[$v] = 'o.processingStatus = u.processingStatus';
}
elseif($this->uploadType == $this->SKELETAL || $this->uploadType == $this->NFNUPLOAD){
$sqlFragArr[$v] = 'o.'.$v.' = IFNULL(o.'.$v.',u.'.$v.')';
// start NEON customization
if($this->overwriteData){
$sqlFragArr[$v] = 'o.' . $v . ' = u.' . $v;
}
else{
$sqlFragArr[$v] = 'o.'.$v.' = IFNULL(o.'.$v.',u.'.$v.')';
}
// end NEON customization
}
else{
$sqlFragArr[$v] = 'o.'.$v.' = u.'.$v;
Expand Down Expand Up @@ -1013,8 +1021,16 @@ private function versionInternalEdits(){
foreach($this->targetFieldArr as $field){
if(in_array($field, $excludedFieldArr)) continue;
if($r[$field] != $r['old_'.$field]){
if($this->uploadType == $this->SKELETAL && $r['old_'.$field]) continue;
$this->insertOccurEdit($r['occid'], $field, $r[$field], $r['old_'.$field]);
// start NEON customization
if($this->uploadType == $this->SKELETAL){
if ($this->overwriteData || !$r['old_'.$field]) {
$this->insertOccurEdit($r['occid'], $field, $r[$field], $r['old_'.$field]);
}
else {
continue;
}
}
// end NEON customization
}
}
}
Expand Down Expand Up @@ -2207,6 +2223,10 @@ public function setVersionDataEdits($v){
$this->versionDataEdits = $v;
}

public function setOverwriteData($v){
$this->overwriteData = $v;
}

public function setVerifyImageUrls($v){
$this->verifyImageUrls = $v;
}
Expand Down
8 changes: 8 additions & 0 deletions collections/admin/specuploadmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$matchCatNum = array_key_exists('matchcatnum',$_REQUEST)?true:false;
$matchOtherCatNum = array_key_exists('matchothercatnum',$_REQUEST)&&$_REQUEST['matchothercatnum']?true:false;
$versionData = array_key_exists('versiondata',$_REQUEST) && $_REQUEST['versiondata']?true:false;
$overwriteData = array_key_exists('allowOverwrite',$_REQUEST) && $_REQUEST['allowOverwrite']?true:false;
$verifyImages = array_key_exists('verifyimages',$_REQUEST) && $_REQUEST['verifyimages']?true:false;
$processingStatus = array_key_exists('processingstatus',$_REQUEST)?$_REQUEST['processingstatus']:'';
$dbpk = array_key_exists('dbpk',$_REQUEST)?$_REQUEST['dbpk']:'';
Expand All @@ -39,6 +40,7 @@
if($matchCatNum !== true) $matchCatNum = false;
if($matchOtherCatNum !== true) $matchOtherCatNum = false;
if($versionData !== true) $versionData = false;
if($overwriteData !== true) $overwriteData = false;
if($verifyImages !== true) $verifyImages = false;
if(!preg_match('/^[a-zA-Z0-9\s_-]+$/',$processingStatus)) $processingStatus = '';
if($dbpk) $dbpk = htmlspecialchars($dbpk);
Expand Down Expand Up @@ -75,6 +77,7 @@
$duManager->setMatchCatalogNumber($matchCatNum);
$duManager->setMatchOtherCatalogNumbers($matchOtherCatNum);
$duManager->setVersionDataEdits($versionData);
$duManager->setOverwriteData($overwriteData);
$duManager->setVerifyImageUrls($verifyImages);
$duManager->setProcessingStatus($processingStatus);

Expand Down Expand Up @@ -633,6 +636,11 @@ function pkChanged(selObj){
<input name="versiondata" type="checkbox" value="1">
<?php echo (isset($LANG['VERSION_DATA_CHANGES'])?$LANG['VERSION_DATA_CHANGES']:'Version data changes'); ?>
</div>

<div style="margin:10px 0px;">
<input name="overwritedata" type="checkbox" value="1">
<?php echo (isset($LANG['OVERWRITE_DATA'])?$LANG['OVERWRITE_DATA']:'Overwrite existing data'); ?>
</div>
<?php
}
?>
Expand Down
4 changes: 4 additions & 0 deletions collections/admin/specuploadprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$matchCatNum = array_key_exists('matchcatnum',$_REQUEST)?true:false;
$matchOtherCatNum = array_key_exists('matchothercatnum',$_REQUEST)&&$_REQUEST['matchothercatnum']?true:false;
$versionData = array_key_exists('versiondata',$_REQUEST) && $_REQUEST['versiondata']?true:false;
$overwriteData = array_key_exists('overwritedata',$_REQUEST) && $_REQUEST['overwritedata']?true:false;
$verifyImages = array_key_exists('verifyimages',$_REQUEST)&&$_REQUEST['verifyimages']?true:false;
$processingStatus = array_key_exists('processingstatus',$_REQUEST)?$_REQUEST['processingstatus']:'';
$finalTransfer = array_key_exists('finaltransfer',$_REQUEST)?$_REQUEST['finaltransfer']:0;
Expand All @@ -41,6 +42,7 @@
if($matchCatNum !== true) $matchCatNum = false;
if($matchOtherCatNum !== true) $matchOtherCatNum = false;
if($versionData !== true) $versionData = false;
if($overwriteData !== true) $overwriteData = false;
if($verifyImages !== true) $verifyImages = false;
if(!preg_match('/^[a-zA-Z0-9\s_-]+$/',$processingStatus)) $processingStatus = '';
if(!is_numeric($finalTransfer)) $finalTransfer = 0;
Expand Down Expand Up @@ -83,6 +85,7 @@
$duManager->setMatchCatalogNumber($matchCatNum);
$duManager->setMatchOtherCatalogNumbers($matchOtherCatNum);
$duManager->setVersionDataEdits($versionData);
$duManager->setOverwriteData($overwriteData);
$duManager->setVerifyImageUrls($verifyImages);
$duManager->setProcessingStatus($processingStatus);

Expand Down Expand Up @@ -234,6 +237,7 @@
<input type="hidden" name="uploadtype" value="<?php echo $uploadType; ?>" >
<input type="hidden" name="observeruid" value="<?php echo $observerUid; ?>" >
<input type="hidden" name="versiondata" value="<?php echo ($versionData?'1':'0'); ?>" >
<input type="hidden" name="overwritedata" value="<?php echo ($overwriteData?'1':'0'); ?>" >
<input type="hidden" name="verifyimages" value="<?php echo ($verifyImages?'1':'0'); ?>" >
<input type="hidden" name="processingstatus" value="<?php echo $processingStatus;?>" >
<input type="hidden" name="uspid" value="<?php echo $uspid;?>" >
Expand Down
3 changes: 2 additions & 1 deletion content/lang/collections/admin/specupload.en.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
$LANG['VER_MAPPING'] = 'Verify Mapping';
$LANG['SAVE_MAP'] = 'Save Mapping';
$LANG['VERSION_DATA_CHANGES'] = 'Version data changes';
$LANG['OVERWRITE_DATA'] = 'Overwrite existing data';
$LANG['VER_LINKS_MEDIA'] = 'Verify image links from associatedMedia field';
$LANG['SKEL_EXPLAIN'] = 'Skeletal Files consist of stub data that is easy to capture in bulk during the imaging process.
This data is used to seed new records to which images are linked.
Expand All @@ -121,7 +122,7 @@
$LANG['SKEL_EXPLAIN_P1'] = 'General file uploads typically consist of full records, while skeletal uploads will almost always be an annotated record with data for only a few selected fields';
$LANG['SKEL_EXPLAIN_P2'] = 'The catalog number field is required for skeletal file uploads since this field is used to find matches on images or existing records';
$LANG['SKEL_EXPLAIN_P3'] = 'In cases where a record already exists, a general file upload will completely replace the existing record with the data in the new record.
On the other hand, a skeletal upload will augment the existing record only with new field data. Fields are only added if data does not already exist within the target field.';
On the other hand, a skeletal upload will augment the existing record only with new field data. Fields are only added if data does not already exist within the target field, unless the option to overwrite existing data is selected';
$LANG['SKEL_EXPLAIN_P4'] = 'If a record DOES NOT already exist, a new record will be created in both cases, but only the skeletal record will be tagged as unprocessed';
$LANG['NOT_AUTH'] = 'ERROR: you are not authorized to upload to this collection';
$LANG['PAGE_ERROR'] = 'ERROR: Either you have tried to reach this page without going through the collection management menu or you have tried to upload a file that is too large.
Expand Down
1 change: 1 addition & 0 deletions content/lang/collections/admin/specupload.es.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
$LANG['VER_MAPPING'] = 'Verificar Mapeo';
$LANG['SAVE_MAP'] = 'Guardar Mapeo';
$LANG['VERSION_DATA_CHANGES'] = 'Version data changes';
$LANG['OVERWRITE_DATA'] = 'Sobrescribir datos existentes';
$LANG['VER_LINKS_MEDIA'] = 'Verificar enlaces de imágenes en el campo associatedMedia';
$LANG['SKEL_EXPLAIN'] = 'Los Archivos Esqueléticos consisten en un conjunnto de datos que son fáciles de capturar por lote durante el procesamiento de imágenes.
Los datos son utilizados para crear nuevos registros a los cuales las imágenes son vinculados.
Expand Down
1 change: 1 addition & 0 deletions content/lang/collections/admin/specupload.fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
$LANG['LOADING_DATA'] = 'Chargement Données dans Symbiota';
$LANG['VER_MAPPING'] = 'Vérifier Mappage';
$LANG['VERSION_DATA_CHANGES'] = 'Version data changes';
$LANG['OVERWRITE_DATA'] = 'Ecraser les données existantes';
$LANG['SAVE_MAP'] = 'Enregistrer Mappage';
$LANG['VER_LINKS_MEDIA'] = "Vérifier les liens d'image à partir du champ associatedMedia (Média Associé)";
$LANG['SKEL_EXPLAIN'] = "Les fichiers squelettes sont constitués de données stub faciles à capturer en masse pendant le processus d'imagerie.
Expand Down