This allows admins to reject all entries, instead of just one
544013
def reject_user_timesheet(request, user_id):
    
    form = YearMonthForm(request.GET or request.POST)
    user = User.objects.get(pk=user_id)
    if form.is_valid():
        from_date, to_date = form.save()
        entries = Entry.no_join.filter(
            status=Entry.VERIFIED, user=user, start_time__gte=from_date,
            end_time__lte=to_date)
        if request.POST.get('yes'):
            if entries.exists():
                count = entries.count()
                Entry.no_join.filter(pk__in=entries).update(status=Entry.UNVERIFIED)
                msg = 'You have rejected %d previously verified entries.' \
                    % count
            else:
                msg = 'There are no verified entries to reject.'
            messages.info(request, msg)
        else:
            return render(request, 'timepiece/user/timesheet/reject.html', {
                'date': from_date,
                'timesheet_user': user
            })
    else:
        msg = 'You must provide a month and year for entries to be rejected.'
        messages.error(request, msg)

    url = reverse('view_user_timesheet', args=(user_id,))
    return HttpResponseRedirect(url)
1194375
def delete(bad_entry):
    
    entries = read()
    kept_entries = [x for x in entries if x.rstrip() != bad_entry]
    write(kept_entries)
183973
def reject( self ):
        
        if ( self == XConfigDialog._instance ):
            XConfigDialog._instance = None
        
        super(XConfigDialog, self).reject()
378054
def reject_insert(self, s_pappid, order_id, reason, redirect_url=None):
        
        return self._post(
            'rejectinsert',
            data={
                's_pappid': s_pappid,
                'order_id': order_id,
                'reason': reason,
                'url': redirect_url,
            },
        )
623995
def cancel(self, *ids):
		
		ncancelled = 0
		with self.lock:
			for id in ids:
				try:
					if self._status[id] == 'SUBMITTED':
						self._status[id] = 'CANCELLED'
						ncancelled += 1
				except IndexError:
					pass
		return ncancelled
1011695
public function onBanSelf()
    {
        $rulesToRemove = ['notSubmitterIpHostname'];
        $rules         = (array) array_get($this->rules, 'value', []);

        foreach ($rules as $index => $rule) {
            if (in_array($rule, $rulesToRemove, true)) {
                unset($this->rules['value'][$index]);
            }
        }
    }
1103636
def _prune_entries(self, num):
        ""
        while num > 0:
            self.access_log_lock.acquire()
            p = self.access_log.pop()
            self.access_log_lock.release()

            if not p.is_valid:
                continue # Invalidated entry, skip

            dict.pop(self, p.key, None)
            self.access_lookup.pop(p.key, None)
            num -= 1
830280
def remove_not_valid_selections(self):
        
        value = [v for v in self.get_value() if self.valid_selection(v)]
        self.set_value(value)
465534
public function process_submission() {
        global $DB;
        // Delete all records, then add back the ones that should be allowed.
        $DB->delete_records($this->tablename);
        foreach ($this->roles as $fromroleid => $notused) {
            foreach ($this->roles as $targetroleid => $alsonotused) {
                if (optional_param('s_' . $fromroleid . '_' . $targetroleid, false, PARAM_BOOL)) {
                    $this->set_allow($fromroleid, $targetroleid);
                }
            }
        }
    }
301919
def reject(&block)
      current = get_current
      ilist = self.class.new
      a = @images.reject(&block)
      a.each { |image| ilist << image }
      ilist.set_current current
      ilist
    end
1344622
def reject_entry(request, entry_id):
    
    return_url = request.GET.get('next', reverse('dashboard'))
    try:
        entry = Entry.no_join.get(pk=entry_id)
    except:
        message = 'No such log entry.'
        messages.error(request, message)
        return redirect(return_url)

    if entry.status == Entry.UNVERIFIED or entry.status == Entry.INVOICED:
        msg_text = 'This entry is unverified or is already invoiced.'
        messages.error(request, msg_text)
        return redirect(return_url)

    if request.POST.get('Yes'):
        entry.status = Entry.UNVERIFIED
        entry.save()
        msg_text = 'The entry\'s status was set to unverified.'
        messages.info(request, msg_text)
        return redirect(return_url)
    return render(request, 'timepiece/entry/reject.html', {
        'entry': entry,
        'next': request.GET.get('next'),
    })
1165136
def rejected(self):
        
        self._resetWidgets()
        self.exported.emit(False)
        self.reject()
617179
def rejectionOptionsList(self):
        ""
        plone = getSite()
        settings = plone.bika_setup
        # RejectionReasons will return something like:
        # [{'checkbox': u'on', 'textfield-2': u'b', 'textfield-1': u'c', 'textfield-0': u'a'}]
        if len(settings.RejectionReasons) > 0:
            reject_reasons = settings.RejectionReasons[0]
        else:
            return []
        sorted_keys = sorted(reject_reasons.keys())
        if 'checkbox' in sorted_keys:
            sorted_keys.remove('checkbox')
        # Building the list with the values only because the keys are not needed any more
        items = []
        for key in sorted_keys:
            items.append(reject_reasons[key].strip())
        return items
96220
public function removeAllValidation()
    {
        if ($this->form) {
            foreach ($this->constraints as $fieldName => $constraints) {
                foreach ($constraints as $constraint) {
                    $constraint->removeParsley();
                    unset($constraint);
                }
            }
        }
        $this->constraints = array();
    }
1347450
function applyDisallowedRuleToHash( itemsRule, items ) {
		if ( !itemsRule )
			return false;

		var hadInvalid = false,
			allDisallowed = itemsRule === true;

		for ( var name in items ) {
			if ( allDisallowed || itemsRule( name ) ) {
				delete items[ name ];
				hadInvalid = true;
			}
		}

		return hadInvalid;
	}
810477
public synchronized void reject() {
        JingleSession session;
        synchronized (manager) {
            try {
                session = manager.createIncomingJingleSession(this);
                // Acknowledge the IQ reception
                session.setSid(this.getSessionID());
                // session.sendAck(this.getJingle());
                session.updatePacketListener();
                session.terminate("Declined");
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, "Exception in reject", e);
            }
        }
     }
1021433
def _delete_exceeding_submissions(self, username, task, max_submissions_bound=-1):
        

        if max_submissions_bound <= 0:
            max_submissions = task.get_stored_submissions()
        elif task.get_stored_submissions() <= 0:
            max_submissions = max_submissions_bound
        else:
            max_submissions = min(max_submissions_bound, task.get_stored_submissions())

        if max_submissions <= 0:
            return []
        tasks = list(self._database.submissions.find(
            {"username": username, "courseid": task.get_course_id(), "taskid": task.get_id()},
            projection=["_id", "status", "result", "grade", "submitted_on"],
            sort=[('submitted_on', pymongo.ASCENDING)]))

        # List the entries to keep
        to_keep = set([])

        if task.get_evaluate() == 'best':
            # Find the best "status"="done" and "result"="success"
            idx_best = -1
            for idx, val in enumerate(tasks):
                if val["status"] == "done":
                    if idx_best == -1 or tasks[idx_best]["grade"] < val["grade"]:
                        idx_best = idx

            # Always keep the best submission
            if idx_best != -1:
                to_keep.add(tasks[idx_best]["_id"])
        elif task.get_evaluate() == 'student':
            user_task = self._database.user_tasks.find_one({
                "courseid": task.get_course_id(),
                "taskid": task.get_id(),
                "username": username
            })

            submissionid = user_task.get('submissionid', None)
            if submissionid:
                to_keep.add(submissionid)

        # Always keep running submissions
        for val in tasks:
            if val["status"] == "waiting":
                to_keep.add(val["_id"])

        while len(to_keep) < max_submissions and len(tasks) > 0:
            to_keep.add(tasks.pop()["_id"])

        to_delete = {val["_id"] for val in tasks}.difference(to_keep)
        self._database.submissions.delete_many({"_id": {"$in": list(to_delete)}})

        return list(map(str, to_delete))