SOURCES: eventum-att_error_rollback.patch - instead added second p...
glen
glen at pld-linux.org
Wed Mar 14 00:38:27 CET 2007
Author: glen Date: Tue Mar 13 23:38:27 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- instead added second parameter to Attachment::remove as need $issue_id
---- Files affected:
SOURCES:
eventum-att_error_rollback.patch (1.4 -> 1.5)
---- Diffs:
================================================================
Index: SOURCES/eventum-att_error_rollback.patch
diff -u SOURCES/eventum-att_error_rollback.patch:1.4 SOURCES/eventum-att_error_rollback.patch:1.5
--- SOURCES/eventum-att_error_rollback.patch:1.4 Wed Mar 14 00:32:30 2007
+++ SOURCES/eventum-att_error_rollback.patch Wed Mar 14 00:38:22 2007
@@ -1,56 +1,30 @@
---- eventum/include/class.attachment.php 2007-03-14 01:29:55.514861000 +0200
-+++ eventum/include/class.attachment.php 2007-03-14 01:30:07.615137261 +0200
-@@ -272,6 +272,7 @@
-
- /**
+--- eventum/include/class.attachment.php 2007-03-14 01:30:07.615137261 +0200
++++ eventum/include/class.attachment.php 2007-03-14 01:35:40.772734359 +0200
+@@ -274,10 +274,11 @@
* Method used to remove attachments from the database.
-+ * Additionally logs history entry on success.
*
* @param integer $iat_id attachment_id.
++ * @param boolean $add_history whether to add history entry.
* @access public
-@@ -279,8 +280,26 @@
+ * @return integer Numeric code used to check for any errors
*/
- function remove($iat_id)
+- function remove($iat_id)
++ function remove($iat_id, $add_history = true)
{
-+ $res = Attachment::_remove($iat_id);
-+ if ($res == 1) {
-+ Issue::markAsUpdated($issue_id);
-+ // need to save a history entry for this
-+ $usr_id = Auth::getUserID();
-+ History::add($issue_id, $usr_id, History::getTypeID('attachment_removed'), 'Attachment removed by ' . User::getFullName($usr_id));
-+ }
-+ return $res;
-+ }
-+
-+ /**
-+ * Method used to remove attachments from the database.
-+ *
-+ * @param integer $iat_id attachment_id.
-+ * @access private
-+ * @return integer Numeric code used to check for any errors
-+ */
-+ function _remove($iat_id)
-+ {
$iat_id = Misc::escapeInteger($iat_id);
-- $usr_id = Auth::getUserID();
- $stmt = "SELECT
- iat_iss_id
- FROM
-@@ -288,6 +307,7 @@
- WHERE
- iat_id=$iat_id";
- if (Auth::getCurrentRole() < User::getRoleID("Manager")) {
-+ $usr_id = Auth::getUserID();
- $stmt .= " AND
- iat_usr_id=$usr_id";
- }
-@@ -314,15 +334,11 @@
+ $usr_id = Auth::getUserID();
+@@ -314,15 +315,16 @@
for ($i = 0; $i < count($files); $i++) {
Attachment::removeFile($files[$i]['iaf_id']);
}
- Issue::markAsUpdated($issue_id);
- // need to save a history entry for this
- History::add($issue_id, $usr_id, History::getTypeID('attachment_removed'), 'Attachment removed by ' . User::getFullName($usr_id));
++ if ($add_history) {
++ Issue::markAsUpdated($usr_id);
++ // need to save a history entry for this
++ History::add($issue_id, $usr_id, History::getTypeID('attachment_removed'), 'Attachment removed by ' . User::getFullName($usr_id));
++ }
return 1;
}
}
@@ -60,7 +34,7 @@
/**
* Method used to remove a specific file from an attachment, since every
* attachment can have several files associated with it.
-@@ -435,6 +451,11 @@
+@@ -435,6 +437,11 @@
* Method used to associate an attachment to an issue, and all of its
* related files. It also notifies any subscribers of this new attachment.
*
@@ -72,7 +46,7 @@
* @access public
* @param integer $usr_id The user ID
* @param string $status The attachment status
-@@ -468,7 +489,12 @@
+@@ -468,7 +475,12 @@
}
$attachment_id = Attachment::add($_POST["issue_id"], $usr_id, @$_POST["file_description"], $internal_only);
foreach ($files as $file) {
@@ -80,7 +54,7 @@
+ $res = Attachment::addFile($attachment_id, $_POST["issue_id"], $file["filename"], $file["type"], $file["blob"]);
+ if ($res !== true) {
+ // we must rollback whole attachment (all files)
-+ Attachment::_remove($attachment_id);
++ Attachment::remove($attachment_id, false);
+ return -1;
+ }
}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/eventum-att_error_rollback.patch?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list