14 import(
'lib.pkp.classes.db.DAO');
31 public function getById($depositId, $journalId =
null) {
32 $params = array((
int) $depositId);
33 if ($journalId !==
null) $params[] = (int) $journalId;
38 . ($journalId !==
null?
' AND journal_id = ?':
''),
42 if ($result->RecordCount() != 0) {
43 $returner = $this->
_fromRow($result->GetRowAssoc(
false));
57 INSERT INTO pln_deposits
65 (?, ?, ?, %s, NOW(), %s)',
67 $this->datetimeToDB($deposit->getDateModified())
70 (
int) $deposit->getJournalId(),
72 (
int) $deposit->getStatus()
76 return $deposit->getId();
86 UPDATE pln_deposits SET
92 date_modified = NOW(),
93 export_deposit_error = ?
94 WHERE deposit_id = ?',
96 $this->datetimeToDB($deposit->getDateCreated())
99 (
int) $deposit->getJournalId(),
101 (
int) $deposit->getStatus(),
102 $deposit->getExportDepositError(),
103 (
int) $deposit->getId()
114 foreach($deposit->getDepositObjects() as $depositObject) {
115 $depositObjectDao->deleteObject($depositObject);
119 'DELETE from pln_deposits WHERE deposit_id = ?',
120 (
int) $deposit->getId()
129 return $this->
_getInsertId(
'pln_deposits',
'deposit_id');
139 $deposit->setId($row[
'deposit_id']);
140 $deposit->setJournalId($row[
'journal_id']);
141 $deposit->setUUID($row[
'uuid']);
142 $deposit->setStatus($row[
'status']);
143 $deposit->setLastStatusDate($this->
datetimeFromDB($row[
'date_status']));
144 $deposit->setDateCreated($this->
datetimeFromDB($row[
'date_created']));
145 $deposit->setDateModified($this->
datetimeFromDB($row[
'date_modified']));
146 $deposit->setExportDepositError($row[
'export_deposit_error']);
171 if ($result->RecordCount() != 0) {
172 $returner = $this->
_fromRow($result->GetRowAssoc(
false));
188 ORDER BY deposit_id',
205 'SELECT * FROM pln_deposits WHERE journal_id = ? AND status = ?',
208 (
int) PLN_PLUGIN_DEPOSIT_STATUS_NEW
223 FROM pln_deposits AS d
224 WHERE d.journal_id = ?
227 AND d.status & ? = 0',
230 (
int) PLN_PLUGIN_DEPOSIT_STATUS_PACKAGING_FAILED,
231 (
int) PLN_PLUGIN_DEPOSIT_STATUS_TRANSFERRED,
232 (
int) PLN_PLUGIN_DEPOSIT_STATUS_LOCKSS_AGREEMENT
247 FROM pln_deposits AS d
248 WHERE d.journal_id = ?
251 AND d.status & ? = 0',
254 (
int) PLN_PLUGIN_DEPOSIT_STATUS_PACKAGED,
255 (
int) PLN_PLUGIN_DEPOSIT_STATUS_LOCKSS_AGREEMENT,
256 (
int) PLN_PLUGIN_DEPOSIT_STATUS_PACKAGING_FAILED
271 FROM pln_deposits AS d
272 WHERE d.journal_id = ?
273 AND d.status & ? <> 0
275 AND d.status & ? = 0',
278 (
int) PLN_PLUGIN_DEPOSIT_STATUS_TRANSFERRED,
279 (
int) PLN_PLUGIN_DEPOSIT_STATUS_LOCKSS_AGREEMENT,
280 (
int) PLN_PLUGIN_DEPOSIT_STATUS_PACKAGING_FAILED
293 foreach($deposits as $deposit) {
294 $this->deleteDeposit($deposit);