Verified Commit 5781f215 authored by Alexandre Morin's avatar Alexandre Morin
Browse files

Add history search by status

parent cb1f05e7
......@@ -55,19 +55,21 @@ class ArchiveDeliveryRequest extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null)
{
return $this->search("ArchiveDelivery", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate);
return $this->search("ArchiveDelivery", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status);
}
/**
......
......@@ -48,19 +48,21 @@ class ArchiveDestructionRequest extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null)
{
return $this->search("ArchiveDestruction", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate);
return $this->search("ArchiveDestruction", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status);
}
/**
......
......@@ -54,19 +54,21 @@ class ArchiveNotification extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null)
{
return $this->search("ArchiveNotification", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, false);
return $this->search("ArchiveNotification", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status, false);
}
/**
......
......@@ -67,19 +67,21 @@ class ArchiveRestitution extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null)
{
return $this->search("ArchiveRestitution", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate);
return $this->search("ArchiveRestitution", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status);
}
/**
......
......@@ -868,19 +868,21 @@ class ArchiveTransfer extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null)
{
return $this->search("ArchiveTransfer", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, true);
return $this->search("ArchiveTransfer", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status, true);
}
/**
......
......@@ -69,19 +69,21 @@ class ArchiveTransferSending extends abstractMessage
/**
* Get transfer history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null)
public function history($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status)
{
return $this->search("ArchiveTransfer", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, false);
return $this->search("ArchiveTransfer", $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status, false);
}
/**
......
......@@ -166,39 +166,45 @@ class message
/**
* Get processed archive history message
* @param string $type
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $type Type
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @return array Array of medona/message object
*/
public function search($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $isIncoming = null)
public function search($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null, $isIncoming = null)
{
$queryParams = array();
$queryString = $this->searchMessage($type, $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $isIncoming,$queryParams);
$queryString = $this->searchMessage($type, $reference, $archiver, $originator, $depositor, $archivalAgreement, $fromDate, $toDate, $status, $isIncoming,$queryParams);
return $this->sdoFactory->find('medona/message', $queryString, $queryParams, false, false, 300);
}
/**
* Search message by sender / recipient / reference / date
* @param string $type
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $type Type
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
* @param bool $isIncoming Is incoming
* @param string $queryParams Status
*
* @return medona/message[]
*/
public function searchMessage($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $isIncoming = null,&$queryParams)
public function searchMessage($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null, $isIncoming = null, &$queryParams)
{
$queryParts = array();
$currentService = \laabs::getToken("ORGANIZATION");
......@@ -249,6 +255,12 @@ class message
$queryParts[] = "date <= :toDate";
$queryParams['toDate'] = $toDate;
}
if ($status) {
$queryParts[] = "status= :status";
$queryParams['status'] = $status;
}
if ($reference) {
$queryParts[] = "reference= :reference";
$queryParams['reference'] = $reference;
......@@ -1000,7 +1012,7 @@ class message
{
// $queryParts = $this->searchMessage(null, $reference);
$queryParams = array();
$queryString = $this->searchMessage(null, $reference, null, null, null, null, null, null, null,$queryParams);
$queryString = $this->searchMessage(null, $reference, null, null, null, null, null, null, null,null,$queryParams);
$message = $this->sdoFactory->find('medona/message', $queryString, $queryParams, false, false, 300);
......
......@@ -93,17 +93,19 @@ interface archiveDeliveryInterface extends messageInterface
/**
* Get destruction message history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/ArchiveDeliveryRequest/history
*/
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null);
/**
......
......@@ -44,17 +44,19 @@ interface archiveDestructionInterface extends messageInterface
/**
* Get destruction message history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/ArchiveDestructionRequest/history
*/
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null);
/**
* Validate archive delivery request
......
......@@ -44,16 +44,18 @@ interface archiveNotificationInterface
/**
* Get outgoing transfer messages
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/ArchiveNotification/history
*/
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null);
}
......@@ -78,17 +78,19 @@ interface archiveRestitutionInterface extends messageInterface
/**
* Get destruction message history
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/ArchiveRestitution/history
*/
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null , $status = null);
/**
* Accept archive restitution request
......
......@@ -44,17 +44,19 @@ interface archiveTransferInterface
/**
* Get outgoing transfer messages
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/ArchiveTransfer/history
*/
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null);
/**
* Count transfer messages
......
......@@ -95,18 +95,20 @@ interface messageInterface
/**
* Search message by sender / recipient / reference / date
* @param string $type
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @param string $type Type
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @action medona/message/search
*/
public function readSearch($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readSearch($type, $reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null, $status = null);
/**
* Archive messages
......
......@@ -27,7 +27,7 @@
</div>
</div>
<hr/>
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group">
<label class="col-sm-4 text-primary control-label">Archival agency</label>
<div class="col-sm-8">
......@@ -40,20 +40,7 @@
</optgroup>
</select>
</div>
</div><!--
<div class="form-group">
<label class="col-sm-4 text-primary control-label">Originating agency</label>
<div class="col-sm-8">
<select class="form-control input-sm" name="originator">
<option value=""></option>
<?merge ownerOriginatorOrgs ?>
<optgroup label="[?merge .displayName ?]">
<?merge .originators ?>
<option value="[?merge .registrationNumber ?]"><?merge .displayName ?></option>
</optgroup>
</select>
</div>
</div>-->
</div>
<div class="form-group">
<label class="col-sm-4 text-primary control-label">Transferring agency</label>
<div class="col-sm-8">
......@@ -69,7 +56,7 @@
</div>
<br/>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group">
<label class="col-sm-4 text-primary control-label">Archival agreements</label>
<div class="col-sm-8">
......@@ -91,6 +78,24 @@
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-sm-4 text-primary control-label">Status</label>
<div class="col-sm-8">
<select class="form-control input-sm" name="status">
<option value=""></option>
<option value="sent">sent</option>
<option value="validated">validated</option>
<option value="accepted">accepted</option>
<option value="rejected">rejected</option>
<option value="processing">processing</option>
<option value="processed">processed</option>
<option value="error">error</option>
<option value="invalid">invalid</option>
</select>
</div>
</div>
</div>
<div class="clearfix">
<div class="col-xs-12">
......@@ -120,7 +125,7 @@
var messageSearchForm = {
search: function() {
ajax($('#serach'), {
ajax($('#search'), {
type : 'GET',
url : $('#messageType').data('url'),
data : messageSearchForm.serialize(),
......@@ -151,10 +156,10 @@
searchForm.find('input, select').each(function(){
serializedObject[$(this).attr('name')] = $(this).val();
})
});
serializedObject['type'] = $('#messageType').val();
return serializedObject;
},
}
}
</script>
\ No newline at end of file
......@@ -27,16 +27,27 @@ interface transferHistoryInterface
{
/**
* Search form
* @param string $reference
* @param string $archiver
* @param string $originator
* @param string $depositor
* @param string $archivalAgreement
* @param date $fromDate
* @param date $toDate
*
* @uses medona/archiveTransfer/readHistory
* @param string $reference Reference
* @param string $archiver Archiver
* @param string $originator Originator
* @param string $depositor Depositor
* @param string $archivalAgreement Archival agreement
* @param date $fromDate From date
* @param date $toDate To date
* @param string $status Status
*
* @uses medona/archiveTransfer/readHistory
* @return medona/message/transferHistory
*/
public function readTransferHistory($reference = null, $archiver = null, $originator = null, $depositor = null, $archivalAgreement = null, $fromDate = null, $toDate = null);
public function readTransferHistory(
$reference = null,
$archiver = null,
$originator = null,
$depositor = null,
$archivalAgreement = null,
$fromDate = null,
$toDate = null,
$status = null
);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment