Commit f333bf6e by François C.

Fix cancel shift error

parent 9910c111
Pipeline #2890 failed with stage
in 1 minute 6 seconds
...@@ -119,7 +119,7 @@ function add_or_change_shift(new_shift_id) { ...@@ -119,7 +119,7 @@ function add_or_change_shift(new_shift_id) {
error: function(error) { error: function(error) {
closeModal(); closeModal();
selected_shift = null; selected_shift = null;
console.log(error)
if (error.status === 400 && 'msg' in error.responseJSON && error.responseJSON.msg === "Old service in less than 24hours.") { if (error.status === 400 && 'msg' in error.responseJSON && error.responseJSON.msg === "Old service in less than 24hours.") {
alert(`Désolé ! Le service que tu souhaites échanger démarre dans moins de 24h. ` + alert(`Désolé ! Le service que tu souhaites échanger démarre dans moins de 24h. ` +
`Afin de faciliter la logistique des services, il n'est plus possible de l'échanger. ` + `Afin de faciliter la logistique des services, il n'est plus possible de l'échanger. ` +
......
...@@ -292,13 +292,12 @@ class CagetteShift(models.Model): ...@@ -292,13 +292,12 @@ class CagetteShift(models.Model):
coop_logger.error("Model affect shift nobody found : %s", str(cond)) coop_logger.error("Model affect shift nobody found : %s", str(cond))
return response return response
def cancel_shift(self, idsRegisteur, origin='memberspace', description=None): def cancel_shift(self, idsRegisteur, origin='memberspace', description=''):
"""Annule un shift""" """Annule un shift"""
fieldsDatas = { "related_shift_state": 'cancel', fieldsDatas = { "related_shift_state": 'cancel',
"origin": origin, "origin": origin,
"state": 'cancel', "state": 'cancel',
"cancellation_description": description} "cancellation_description": description}
return self.o_api.update('shift.registration', idsRegisteur, fieldsDatas) return self.o_api.update('shift.registration', idsRegisteur, fieldsDatas)
def reopen_shift(self, data): def reopen_shift(self, data):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment