Commit 225b0401 by Damien Moulard

Merge branch 'ticket_1682' into 'evolution_bdm'

Ticket 1682

See merge request !58
parents e2227909 fc8a47ca
Pipeline #1452 passed with stage
in 1 minute 33 seconds
...@@ -89,6 +89,15 @@ class CagetteShift(models.Model): ...@@ -89,6 +89,15 @@ class CagetteShift(models.Model):
shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC") shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC")
return shiftData return shiftData
def shift_is_makeup(self, id):
"""vérifie si une shift est un rattrapage"""
fields = ["is_makeup", "id"]
cond = [['id', '=', id]]
shiftData = self.o_api.search_read('shift.registration', cond, fields)
return shiftData[0]["is_makeup"]
def get_shift_calendar(self, id, start, end): def get_shift_calendar(self, id, start, end):
"""Récupère les shifts à partir de maintenant pour le calendier""" """Récupère les shifts à partir de maintenant pour le calendier"""
cond = [['date_begin', '>', datetime.datetime.now().isoformat()], cond = [['date_begin', '>', datetime.datetime.now().isoformat()],
...@@ -144,6 +153,7 @@ class CagetteShift(models.Model): ...@@ -144,6 +153,7 @@ class CagetteShift(models.Model):
"shift_ticket_id": self.get_shift_ticket(data['idShift'], data['in_ftop_team']), "shift_ticket_id": self.get_shift_ticket(data['idShift'], data['in_ftop_team']),
"shift_type": shift_type, "shift_type": shift_type,
"origin": 'memberspace', "origin": 'memberspace',
"is_makeup": data['is_makeup'],
"state": 'open'} "state": 'open'}
st_r_id = self.o_api.create('shift.registration', fieldsDatas) st_r_id = self.o_api.create('shift.registration', fieldsDatas)
......
...@@ -178,12 +178,15 @@ def change_shift(request): ...@@ -178,12 +178,15 @@ def change_shift(request):
if 'idNewShift' in request.POST and 'idOldShift' in request.POST: if 'idNewShift' in request.POST and 'idOldShift' in request.POST:
idOldShift = request.POST['idOldShift'] idOldShift = request.POST['idOldShift']
listRegister = [int(request.POST['idRegister'])]
data = { data = {
"idPartner": int(request.POST['idPartner']), "idPartner": int(request.POST['idPartner']),
"idShift":int(request.POST['idNewShift']), "idShift":int(request.POST['idNewShift']),
"in_ftop_team":request.POST['in_ftop_team'] "in_ftop_team":request.POST['in_ftop_team'],
"is_makeup":cs.shift_is_makeup(listRegister)
} }
should_block_service_exchange = getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', False) should_block_service_exchange = getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', False)
if should_block_service_exchange: if should_block_service_exchange:
# Block change if old shift is to happen in less than 24 hours # Block change if old shift is to happen in less than 24 hours
...@@ -228,7 +231,8 @@ def add_shift(request): ...@@ -228,7 +231,8 @@ def add_shift(request):
data = { data = {
"idPartner": int(request.POST['idPartner']), "idPartner": int(request.POST['idPartner']),
"idShift":int(request.POST['idNewShift']), "idShift":int(request.POST['idNewShift']),
"in_ftop_team":request.POST['in_ftop_team'] "in_ftop_team":request.POST['in_ftop_team'],
"is_makeup":True
} }
#Insertion du nouveau shift #Insertion du nouveau shift
......
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