Repository: carpentries/amy

Issue:
Remove invoicing link
Please remove the invoicing button from the event page - this is not ready to go live.
The invoicing form (in case anyone has bookmarked it) should not be displayed. That page should read:

> Please contact admin@software-carpentry.org if you need to submit an invoice.  Include the following information in your email: 
> - Link to workshop page in AMY
> - Purpose of invoice
> - Amount of invoice in US Dollars
> - Name, email, phone, and mailing address of person who should receive in invoice



Discussion:
@maneesha you want to disable the admin-only part of AMY that handles invoice requests, correct?

Correct.


Resolving patch:
diff --git a/workshops/views.py b/workshops/views.py
--- a/workshops/views.py
+++ b/workshops/views.py
@@ -1510,37 +1510,42 @@ def events_merge(request):
     return render(request, 'workshops/events_merge.html', context)
 
 
+# disabled as per @maneesha's request (disabled in HTML template)
+# see https://github.com/swcarpentry/amy/issues/1040
 @admin_required
 @permission_required('workshops.add_invoicerequest', raise_exception=True)
 def event_invoice(request, slug):
-    try:
-        event = Event.objects.get(slug=slug)
-    except ObjectDoesNotExist:
-        raise Http404("No event found matching the query.")
-
-    form = InvoiceRequestForm(initial=dict(
-        organization=event.host, date=event.start, event=event,
-        event_location=event.venue, amount=event.admin_fee,
-    ))
-
-    if request.method == 'POST':
-        form = InvoiceRequestForm(request.POST)
-
-        if form.is_valid():
-            form.save()
-            messages.success(request,
-                             'Successfully added an invoice request for {}.'
-                             .format(event.slug))
-            return redirect(reverse('event_details',
-                                    args=[event.slug]))
-        else:
-            messages.error(request, 'Fix errors below.')
-
+    # try:
+    #     event = Event.objects.get(slug=slug)
+    # except ObjectDoesNotExist:
+    #     raise Http404("No event found matching the query.")
+
+    # form = InvoiceRequestForm(initial=dict(
+    #     organization=event.host, date=event.start, event=event,
+    #     event_location=event.venue, amount=event.admin_fee,
+    # ))
+
+    # if request.method == 'POST':
+    #     form = InvoiceRequestForm(request.POST)
+
+    #     if form.is_valid():
+    #         form.save()
+    #         messages.success(request,
+    #                          'Successfully added an invoice request for {}.'
+    #                          .format(event.slug))
+    #         return redirect(reverse('event_details',
+    #                                 args=[event.slug]))
+    #     else:
+    #         messages.error(request, 'Fix errors below.')
+
+    # context = {
+    #     'title_left': 'Event {}'.format(event.slug),
+    #     'title_right': 'New invoice request',
+    #     'event': event,
+    #     'form': form,
+    # }
     context = {
-        'title_left': 'Event {}'.format(event.slug),
-        'title_right': 'New invoice request',
-        'event': event,
-        'form': form,
+        'title': 'Invoice',
     }
     return render(request, 'workshops/event_invoice.html', context)
 


Test patch: