30/08/22 - 13h00
parent
e58000d968
commit
7f4b682572
27
class_mgt.py
27
class_mgt.py
|
@ -1128,16 +1128,19 @@ def pusblish_class(diction):
|
|||
print( "str(my_internal_url) = "+str(my_internal_url)+" --- partner_recid = "
|
||||
+partner_recid+" mydata = "+str(mydata))
|
||||
|
||||
|
||||
'''
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'internal_url': str(my_internal_url), 'partner_owner_recid': partner_recid, 'locked': '0',
|
||||
'valide': '1'},
|
||||
{"$set": mydata},
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
'''
|
||||
ret_val = coll_name.update_many( {'internal_url': str(my_internal_url), 'partner_owner_recid': partner_recid, 'locked': '0',
|
||||
'valide': '1'}, {"$set": mydata}, )
|
||||
|
||||
if (ret_val and ret_val['_id']):
|
||||
nb_doc = str(ret_val['_id'])
|
||||
if (ret_val.matched_count > 0):
|
||||
nb_doc = str(my_internal_url)
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La formation a bien ete publiée =" + str(nb_doc))
|
||||
return True, " La formation " + str(my_internal_url) + "a été publiée"
|
||||
|
@ -1227,15 +1230,21 @@ def unpublish_class(diction):
|
|||
print( " str(my_internal_url) = "+str(my_internal_url)+" partner_recid = "+partner_recid+
|
||||
" mydata = "+str(mydata) )
|
||||
|
||||
'''
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'internal_url': str(my_internal_url), 'partner_owner_recid': partner_recid, 'locked': '0',
|
||||
'valide': '1'},
|
||||
{"$set": mydata},
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
'''
|
||||
|
||||
if (ret_val and ret_val['_id']):
|
||||
nb_doc = str(ret_val['_id'])
|
||||
ret_val = coll_name.update_many(
|
||||
{'internal_url': str(my_internal_url), 'partner_owner_recid': partner_recid, 'locked': '0',
|
||||
'valide': '1'}, {"$set": mydata}, )
|
||||
|
||||
if (ret_val.matched_count > 0):
|
||||
nb_doc = str(my_internal_url)
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La formation a bien ete depubliée =" + str(nb_doc))
|
||||
return True, " La formation " + str(my_internal_url) + "a été depubliée"
|
||||
|
@ -1364,7 +1373,7 @@ def get_class(diction):
|
|||
" internal_url = "+str(my_internal_url)+
|
||||
" filt_title = "+str(filt_title))
|
||||
|
||||
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url},
|
||||
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'published':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
|
||||
):
|
||||
|
@ -1485,7 +1494,7 @@ def get_class_coup_de_coeur(diction):
|
|||
internal_url = str(diction['internal_url'])
|
||||
|
||||
|
||||
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'coeur':'1'},
|
||||
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'coeur':'1', 'published':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
|
||||
):
|
||||
|
@ -1699,9 +1708,7 @@ def get_partner_class(diction):
|
|||
def get_class_global_search(search_string):
|
||||
try:
|
||||
mycommon.myprint(" search_string", search_string)
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
|
||||
dbname = client['cherifdb']
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
val = re.compile(r".*"+search_string+".*")
|
||||
|
@ -1958,7 +1965,7 @@ def get_class_by_metier(diction):
|
|||
|
||||
|
||||
|
||||
for retVal in coll_name.find({'valide': '1', 'locked': '0', 'metier': str(my_metier)},
|
||||
for retVal in coll_name.find({'valide': '1', 'locked': '0', 'metier': str(my_metier), 'published':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
|
||||
).sort([("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING), ]):
|
||||
|
|
|
@ -405,6 +405,9 @@ def createOrder(diction):
|
|||
if diction['periodicite']:
|
||||
new_data['periodicite'] = diction['periodicite']
|
||||
|
||||
if ("end_date" in diction.keys()):
|
||||
if diction['end_date']:
|
||||
new_data['end_date'] = diction['end_date']
|
||||
|
||||
# Recuperation des données client
|
||||
new_data['client_recid'] = user_recid
|
||||
|
@ -515,6 +518,7 @@ def createOrder(diction):
|
|||
new_data_item['prix'] = line_dict['prix']
|
||||
new_data_item['qty'] = line_dict['qty']
|
||||
new_data_item['pack_products'] = line_dict['pack_products']
|
||||
|
||||
new_data_item['amount'] = str(montant_line)
|
||||
row = "item_"+str(i)
|
||||
new_data[str(row)] = new_data_item
|
||||
|
|
|
@ -391,7 +391,11 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
|||
client_pays = diction['invoice_adr_country']
|
||||
order_id = diction['order_id']
|
||||
date_order = diction['order_date']
|
||||
my_end_date = ""
|
||||
|
||||
if ("end_date" in diction.keys()):
|
||||
if diction.keys():
|
||||
my_end_date = "*Offre valable jusqu'au "+str(diction['end_date'])
|
||||
|
||||
nb_line = mycommon.tryInt(diction['nb_product'])
|
||||
|
||||
|
@ -406,6 +410,7 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
|||
print("order_id = " + str(order_id))
|
||||
print("date_order = " + str(date_order))
|
||||
print("nb_line = " + str(nb_line))
|
||||
print("End Date = " + str(my_end_date))
|
||||
|
||||
# Recuperation des produits (max 3 produits)
|
||||
# produit 1
|
||||
|
@ -479,6 +484,7 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
|||
"qty": qty,
|
||||
"unit_price": unit_price,
|
||||
"montant":montant,
|
||||
"end_date": my_end_date,
|
||||
|
||||
}, to=to, bcc=bcc)
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
|
|
|
@ -104,7 +104,7 @@ def login(diction):
|
|||
my_token = create_token_urlsafe()
|
||||
|
||||
# Enregistrement du token
|
||||
dbname2 = client['cherifdb']
|
||||
dbname2 = MYSY_GV.dbname['cherifdb']
|
||||
token_collection = dbname2['user_token']
|
||||
|
||||
tokenfield = {}
|
||||
|
|
21
wrapper.py
21
wrapper.py
|
@ -56,7 +56,7 @@ def get_recherche_gle_class(sentence):
|
|||
|
||||
|
||||
|
||||
for x in coll_name.find({"external_code": {"$in": tab_training}}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0, "valide": 0,
|
||||
for x in coll_name.find({"external_code": {"$in": tab_training}, 'published':'1'}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0, "valide": 0,
|
||||
"locked": 0, "partner_owner_recid": 0, }):
|
||||
mycommon.myprint(x)
|
||||
user = x
|
||||
|
@ -81,7 +81,7 @@ def get_class_by_list_attr(attribut, list_values):
|
|||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
insertObject = []
|
||||
for x in coll_name.find({attribut:{ "$in":ela_array}},{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
for x in coll_name.find({attribut:{ "$in":ela_array}, 'published':'1'},{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }):
|
||||
mycommon.myprint(x)
|
||||
user = x
|
||||
|
@ -104,7 +104,7 @@ def update_class_by_attribut(objId, attribut, value):
|
|||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
insertObject = []
|
||||
for x in coll_name.find({attribut: value}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0,
|
||||
for x in coll_name.find({attribut: value, 'published':'1'}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0,
|
||||
"indexed_title": 0, "valide": 0, "locked": 0, "partner_owner_recid": 0, }):
|
||||
mycommon.myprint(x)
|
||||
user = x
|
||||
|
@ -190,7 +190,7 @@ def get_all_class(diction):
|
|||
insertObject = []
|
||||
|
||||
|
||||
for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1'}, { 'coeur': 1 } ] },
|
||||
for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1', 'published':'1'}, { 'coeur': 1, 'published':'1' } ] },
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }).\
|
||||
limit(nb_formation_a_jouter).\
|
||||
|
@ -300,14 +300,11 @@ def get_training_in_user_zone(diction):
|
|||
# print(" My Data ="+str(mydata))
|
||||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
val_tmp = 1
|
||||
insertObject = []
|
||||
|
||||
print(" critère de recherche : user_country_code = "+str(mydata['user_country_code']).lower()+" ---- user_city = "+str(mydata['user_city']).lower())
|
||||
|
||||
for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1', "zone_diffusion.country":str(mydata['user_country_code']).lower()},
|
||||
{'valide':'1', 'locked':'0', 'isalaune':'1', "zone_diffusion.city":str(mydata['user_city']).lower()} ] },
|
||||
for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1','published':'1', "zone_diffusion.country":str(mydata['user_country_code']).lower()},
|
||||
{'valide':'1', 'locked':'0', 'isalaune':'1', 'published':'1', "zone_diffusion.city":str(mydata['user_city']).lower()} ] },
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }).\
|
||||
limit(MYSY_GV.MAINPAGE_QUERY_LIMIT_ROW).\
|
||||
|
@ -522,7 +519,7 @@ def recherche_text_simple(diction):
|
|||
si ce n'est pas le cas, il faudra à la fin enregistrer la requete avec un result a vide'''
|
||||
nb_result = 0
|
||||
|
||||
for x in coll_name.find({"external_code": {"$in": final_message2}},
|
||||
for x in coll_name.find({"external_code": {"$in": final_message2}, 'published':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0,
|
||||
"indexed_title": 0, "valide": 0, "locked": 0, "partner_owner_recid": 0, }).\
|
||||
sort([("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING), ]):
|
||||
|
@ -596,7 +593,7 @@ def recherche_text_simple(diction):
|
|||
nb_result = 0
|
||||
insertObject = []
|
||||
|
||||
for x in coll_name.find({"external_code":{"$in":tab_training}},
|
||||
for x in coll_name.find({"external_code":{"$in":tab_training}, 'published':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0,
|
||||
"indexed_obj": 0, "indexed_title": 0, "valide": 0,
|
||||
"locked": 0, "partner_owner_recid": 0, }).sort([("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING), ]):
|
||||
|
@ -1136,7 +1133,7 @@ def recherche_tips(diction):
|
|||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
insertObject = []
|
||||
for x in coll_name.find({"external_code": {"$in": tab_training}}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
for x in coll_name.find({"external_code": {"$in": tab_training}, 'published':'1'}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }):
|
||||
#mycommon.myprint(x)
|
||||
user = x
|
||||
|
|
Loading…
Reference in New Issue