private function checkAllFilesHaveBeenSuccessfullyUploaded($value)
 {
     $r = new Rule_File();
     foreach ($value as $i => $attachment) {
         //is delete or no description and no file uploaded => ignore it
         if ("{$i}" != 'delete' && (!empty($attachment['error']) && $attachment['error'] != UPLOAD_ERR_NO_FILE || trim($attachment['description']))) {
             if (!$r->isValid($attachment)) {
                 $this->has_errors = true;
                 $GLOBALS['Response']->addFeedback('error', $this->getLabel() . ' #' . $i . ' has error: ' . $r->getErrorMessage());
             }
         }
     }
 }
 /**
  * Say if the value is valid. If not valid set the internal has_error to true.
  *
  * @param Tracker_Artifact $artifact The artifact
  * @param mixed            $value    data coming from the request. May be string or array. 
  *
  * @return bool true if the value is considered ok
  */
 public function isValid(Tracker_Artifact $artifact, $value)
 {
     $this->has_errors = false;
     if (is_array($value)) {
         //check required
         if ($this->isRequired()) {
             //check that there is at least one file uploaded
             if (!$this->checkThatAtLeastOneFileIsUploaded($value)) {
                 $this->has_errors = true;
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_artifact', 'err_required', $this->getLabel() . ' (' . $this->getName() . ')'));
             }
         }
         //check that all files have been successfully uploaded
         if (!$this->has_errors) {
             $r = new Rule_File();
             foreach ($value as $i => $attachment) {
                 //is delete or no description and no file uploaded => ignore it
                 if ("{$i}" != 'delete' && (!empty($attachment['error']) && $attachment['error'] != UPLOAD_ERR_NO_FILE || trim($attachment['description']))) {
                     if (!$r->isValid($attachment)) {
                         $this->has_errors = true;
                         $GLOBALS['Response']->addFeedback('error', $this->getLabel() . ' #' . $i . ' has error: ' . $r->getErrorMessage());
                     }
                 }
             }
         }
     } else {
         //TODO: WTF?
     }
     return !$this->has_errors;
 }