Merge pull request #11073 from ptibogxiv/patch-158

FIX : dolibarrize fk_soc ->socid for member
This commit is contained in:
Laurent Destailleur 2019-05-02 12:34:23 +02:00 committed by GitHub
commit dcd93db7f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -82,7 +82,7 @@ if (! empty($canvas))
} }
// Security check // Security check
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas); $result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
if ($id > 0) if ($id > 0)
{ {
@ -163,10 +163,10 @@ if (empty($reshook))
$error=0; $error=0;
if (! $error) if (! $error)
{ {
if ($socid != $object->fk_soc) // If link differs from currently in database if ($socid != $object->socid) // If link differs from currently in database
{ {
$sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
$sql.=" WHERE fk_soc = '".$socid."'"; $sql.=" WHERE socid = '".$socid."'";
$sql.=" AND entity = ".$conf->entity; $sql.=" AND entity = ".$conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -492,7 +492,7 @@ if (empty($reshook))
//$object->note = $comment; //$object->note = $comment;
$object->morphy = $morphy; $object->morphy = $morphy;
$object->user_id = $userid; $object->user_id = $userid;
$object->fk_soc = $socid; $object->socid = $socid;
$object->public = $public; $object->public = $public;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -1333,10 +1333,10 @@ else
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">'; print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
if ($object->fk_soc) if ($object->socid)
{ {
$company=new Societe($db); $company=new Societe($db);
$result=$company->fetch($object->fk_soc); $result=$company->fetch($object->socid);
print $company->getNomUrl(1); print $company->getNomUrl(1);
} }
else else
@ -1421,7 +1421,7 @@ else
$text=$langs->trans("ConfirmCreateLogin").'<br>'; $text=$langs->trans("ConfirmCreateLogin").'<br>';
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser");
else $text.=$langs->trans("UserWillBeInternalUser"); else $text.=$langs->trans("UserWillBeInternalUser");
} }
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes'); print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
@ -1688,17 +1688,17 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
print $form->select_company($object->fk_soc, 'socid', '', 1); print $form->select_company($object->socid, 'socid', '', 1);
print '</td>'; print '</td>';
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
} }
else else
{ {
if ($object->fk_soc) if ($object->socid)
{ {
$company=new Societe($db); $company=new Societe($db);
$result=$company->fetch($object->fk_soc); $result=$company->fetch($object->socid);
print $company->getNomUrl(1); print $company->getNomUrl(1);
} }
else else
@ -1848,7 +1848,7 @@ else
} }
// Create third party // Create third party
if (! empty($conf->societe->enabled) && ! $object->fk_soc) if (! empty($conf->societe->enabled) && ! $object->socid)
{ {
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {

View File

@ -10,6 +10,7 @@
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -557,7 +558,7 @@ class Adherent extends CommonObject
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null"); $sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null"); $sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null"); $sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null");
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");