Merge pull request #11847 from ptibogxiv/patch-257
NEW: Option to allow to create members from third-party
This commit is contained in:
commit
3acf7211c3
@ -867,6 +867,18 @@ else
|
|||||||
$object->country=$tmparray['label'];
|
$object->country=$tmparray['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($socid)) {
|
||||||
|
$object = new Societe($db);
|
||||||
|
if ($socid > 0) $object->fetch($socid);
|
||||||
|
|
||||||
|
if (! ($object->id > 0))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print($langs->trans('ErrorRecordNotFound'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewMember"), '', 'members');
|
print load_fiche_titre($langs->trans("NewMember"), '', 'members');
|
||||||
@ -905,6 +917,7 @@ else
|
|||||||
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||||
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|||||||
@ -581,6 +581,7 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
$sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
||||||
$sql.= ", morphy = '".$this->db->escape($this->morphy)."'";
|
$sql.= ", morphy = '".$this->db->escape($this->morphy)."'";
|
||||||
$sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
$sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
||||||
|
if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
|
||||||
if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||||
if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
||||||
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
||||||
|
|||||||
@ -47,7 +47,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
|
||||||
$langs->loadLangs(array("companies","commercial","bills","banks","users"));
|
$langs->loadLangs(array("companies", "commercial", "bills", "banks", "users"));
|
||||||
|
if (! empty($conf->adherent->enabled)) $langs->load("members");
|
||||||
if (! empty($conf->categorie->enabled)) $langs->load("categories");
|
if (! empty($conf->categorie->enabled)) $langs->load("categories");
|
||||||
if (! empty($conf->incoterm->enabled)) $langs->load("incoterm");
|
if (! empty($conf->incoterm->enabled)) $langs->load("incoterm");
|
||||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||||
@ -2665,6 +2666,16 @@ else
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->adherent->enabled))
|
||||||
|
{
|
||||||
|
$adh = new Adherent($db);
|
||||||
|
$result=$adh->fetch('', '', $object->id);
|
||||||
|
if ($result == 0 && ($object->client == 1 || $object->client == 3) && ! empty($conf->global->MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS))
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/card.php?&action=create&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("NewMember")).'">'.$langs->trans("NewMember").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->rights->societe->supprimer)
|
if ($user->rights->societe->supprimer)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a></div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user