From 6cc872abd85d94c58b0de0ebad71924cf094d48c Mon Sep 17 00:00:00 2001 From: bagtaib Date: Mon, 22 Aug 2022 09:50:45 +0100 Subject: [PATCH] . --- htdocs/public/partnership/new.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 1c3e945b375..f08a23cd406 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -217,7 +217,7 @@ if (empty($reshook) && $action == 'add') { } // need to change this part - $partnership->statut = 0; + $partnership->status = 0; $partnership->firstname = GETPOST('firstname'); $partnership->lastname = GETPOST('lastname'); $partnership->address = GETPOST('address'); @@ -235,8 +235,8 @@ if (empty($reshook) && $action == 'add') { if ($ret < 0) { $error++; } - - $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE nom='".$db->escape(GETPOST('societe'))."'"; + // test if societe already exist + $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE nom='".GETPOST('societe')."'"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -258,6 +258,10 @@ if (empty($reshook) && $action == 'add') { $resql = $db->query($sql); $partnership->fk_soc = $company->id; } + else { + $don=$result->fetch(); + $partnership->fk_soc =$don['rowid']; + } $result = $partnership->create($user); if ($result > 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -345,7 +349,6 @@ if (empty($reshook) && $action == 'add') { } }*/ - // test if societe or email already exist