New: Can create a third party from a member.
This commit is contained in:
parent
6ba8bd8303
commit
ce317d6084
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -19,11 +19,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/adherents/fiche.php
|
||||
\ingroup adherent
|
||||
\brief Page d'ajout, edition, suppression d'une fiche adherent
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/adherents/fiche.php
|
||||
* \ingroup adherent
|
||||
* \brief Page d'ajout, edition, suppression d'une fiche adherent
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
|
||||
@ -67,7 +67,7 @@ $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Create user from a memeber
|
||||
// Create user from a member
|
||||
if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer)
|
||||
{
|
||||
// Recuperation contact actuel
|
||||
@ -92,6 +92,30 @@ if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $
|
||||
}
|
||||
}
|
||||
|
||||
// Create third party from a member
|
||||
if ($_POST["action"] == 'confirm_create_thirdparty' && $_POST["confirm"] == 'yes' && $user->rights->societe->creer)
|
||||
{
|
||||
$adh = new Adherent($db);
|
||||
$result = $adh->fetch($_GET["rowid"]);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation user
|
||||
$company = new Societe($db);
|
||||
$result=$company->create_from_member($adh,$_POST["name"]);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$msg=$langs->trans($company->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg=$adh->error;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->id = $rowid;
|
||||
@ -826,18 +850,41 @@ if ($rowid && $action != 'edit')
|
||||
$formquestion=array(
|
||||
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login));
|
||||
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion);
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion);
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Confirm remove member
|
||||
// Confirm create third party
|
||||
if ($_GET["action"] == 'create_thirdparty')
|
||||
{
|
||||
$name =$adh->nom;
|
||||
if ($adh->nom && $adh->prenom) $name.=' ';
|
||||
$name.=$adh->prenom;
|
||||
if (! empty($name))
|
||||
{
|
||||
if ($adh->societe) $name.=' ('.$adh->societe.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$name=$adh->societe;
|
||||
}
|
||||
|
||||
// Create a form array
|
||||
$formquestion=array(
|
||||
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
|
||||
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion);
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Confirm remove member
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Confirm validate memeber
|
||||
// Confirm validate member
|
||||
if ($action == 'valid')
|
||||
{
|
||||
// Cree un tableau formulaire
|
||||
@ -930,32 +977,32 @@ if ($rowid && $action != 'edit')
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$adh->getmorphylib().'</td></tr>';
|
||||
|
||||
// Tiers
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.' </td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.'</td></tr>';
|
||||
|
||||
// Adresse
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).' </td></tr>';
|
||||
// Adresse
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).'</td></tr>';
|
||||
|
||||
// CP / Ville
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'</td></tr>';
|
||||
|
||||
// Pays
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.getCountryLabel($adh->pays_id).'</td></tr>';
|
||||
|
||||
// Tel pro.
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($adh->phone,$adh->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($adh->phone,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($adh->phone_perso,$adh->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($adh->phone_perso,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($adh->phone_mobile,$adh->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($adh->phone_mobile,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($adh->email,0,0,1).' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($adh->email,0,$adh->fk_soc,1).'</td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dolibarr_print_date($adh->naiss,'day').' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dolibarr_print_date($adh->naiss,'day').'</td></tr>';
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($adh->public).'</td></tr>';
|
||||
@ -975,7 +1022,23 @@ if ($rowid && $action != 'edit')
|
||||
else print $langs->trans("NoDolibarrAccess");
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Third party Dolibarr
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ThirdPartyDolibarr").'</td><td class="valeur">';
|
||||
if ($adh->fk_soc)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($adh->fk_soc);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoThirdPartyAssociatedToMember");
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributs
|
||||
foreach($adho->attribute_label as $key=>$value)
|
||||
{
|
||||
@ -1069,7 +1132,20 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
// Create third party
|
||||
if ($conf->societe->enabled && ! $adh->fk_soc)
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?rowid='.$adh->id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("CreateDolibarrThirdParty")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($user->rights->adherent->supprimer)
|
||||
{
|
||||
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/adherents/index.php
|
||||
\ingroup adherent
|
||||
\brief Page accueil module adherents
|
||||
*/
|
||||
* \file htdocs/adherents/index.php
|
||||
* \ingroup adherent
|
||||
* \brief Page accueil module adherents
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
||||
@ -42,22 +42,8 @@ print_fiche_titre($langs->trans("MembersArea"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="100%" colspan="2" class="notopnoleft">';
|
||||
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MembersStatusToValid").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MenuMembersNotUpToDate").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MenuMembersUpToDate").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MembersStatusResiliated").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
|
||||
|
||||
$Adherents=array();
|
||||
$AdherentsAValider=array();
|
||||
$AdherentsResilies=array();
|
||||
@ -96,13 +82,14 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
$Cotisants[$objp->rowid]=0; // Calculé plus loin
|
||||
$Cotisants[$objp->rowid]=0; // Calcule plus loin
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
|
||||
# Liste les cotisants a jour
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
@ -112,22 +99,59 @@ $sql.= " GROUP BY d.fk_adherent_type";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$Cotisants[$objp->fk_adherent_type]=$objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$Cotisants[$objp->fk_adherent_type]=$objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td width="30%" class="notopnoleft" valign="top">';
|
||||
|
||||
|
||||
// Formulaire recherche adherent
|
||||
print '<form action="liste.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=false;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print $langs->trans("Name").':</td><td><input type="text" name="search" class="flat" size="16">';
|
||||
print '</td><td rowspan="2"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">';
|
||||
print '</td></tr>';
|
||||
print "</table></form>";
|
||||
|
||||
|
||||
print '</td><td class="notopnoleftnoright" valign="top">';
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
$SommeA=0;
|
||||
$SommeB=0;
|
||||
$SommeC=0;
|
||||
$SommeD=0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MembersStatusToValid").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MenuMembersNotUpToDate").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MenuMembersUpToDate").'</td>';
|
||||
print '<td align=right>'.$langs->trans("MembersStatusResiliated").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -152,38 +176,10 @@ print '<td align="right"><b>'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->c
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td width="30%" class="notopnoleft" valign="top">';
|
||||
|
||||
|
||||
// Formulaire recherche adhérent
|
||||
print '<form action="liste.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=false;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print $langs->trans("Name").':</td><td><input type="text" name="search" class="flat" size="16">';
|
||||
print '</td><td rowspan="2"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">';
|
||||
print '</td></tr>';
|
||||
print "</table></form>";
|
||||
|
||||
|
||||
print '</td><td class="notopnoleftnoright" valign="top">';
|
||||
print "<br>\n";
|
||||
|
||||
/*
|
||||
* Dernières adherent
|
||||
* Dernieres adherent
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
@ -198,33 +194,33 @@ $sql.= $db->plimit($max, 0);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastMembersModified",$max).'</td></tr>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastMembersModified",$max).'</td></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->ref=trim($obj->prenom.' '.$obj->nom);
|
||||
$statictype->id=$obj->typeid;
|
||||
$statictype->libelle=$obj->libelle;
|
||||
print '<td>'.$staticmember->getNomUrl(1).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1).'</td>';
|
||||
print '<td>'.dolibarr_print_date($obj->datem,'dayhour').'</td>';
|
||||
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$obj->date_end_subscription,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->ref=trim($obj->prenom.' '.$obj->nom);
|
||||
$statictype->id=$obj->typeid;
|
||||
$statictype->libelle=$obj->libelle;
|
||||
print '<td>'.$staticmember->getNomUrl(1).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1).'</td>';
|
||||
print '<td>'.dolibarr_print_date($obj->datem,'dayhour').'</td>';
|
||||
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$obj->date_end_subscription,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -233,7 +229,7 @@ else
|
||||
|
||||
|
||||
|
||||
// Tableau résumé par an
|
||||
// Tableau r<EFBFBD>sum<EFBFBD> par an
|
||||
$Total=array();
|
||||
$Number=array();
|
||||
$tot=0;
|
||||
@ -249,18 +245,18 @@ if(isset($date_select) && $date_select != '')
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$year=dolibarr_print_date($objp->dateadh,"%Y");
|
||||
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation;
|
||||
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
|
||||
$tot+=$objp->cotisation;
|
||||
$numb+=1;
|
||||
$i++;
|
||||
}
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$year=dolibarr_print_date($objp->dateadh,"%Y");
|
||||
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation;
|
||||
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
|
||||
$tot+=$objp->cotisation;
|
||||
$numb+=1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -275,8 +271,8 @@ $var=true;
|
||||
krsort($Total);
|
||||
foreach ($Total as $key=>$value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"cotisations.php?date_select=$key\">$key</a></td>";
|
||||
print "<td align=\"right\">".$Number[$key]."</td>";
|
||||
print "<td align=\"right\">".price($value)."</td>";
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/societe.php
|
||||
\ingroup company
|
||||
\brief Page d'administration/configuration du module Societe
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/admin/societe.php
|
||||
\ingroup company
|
||||
\brief Page d'administration/configuration du module Societe
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
@ -66,15 +66,15 @@ if ($_GET["action"] == 'setcodecompta')
|
||||
|
||||
if ($_POST["action"] == 'usesearchtoselectcompany')
|
||||
{
|
||||
if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectcompany"]))
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectcompany"]))
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// define constants for tigre model
|
||||
@ -123,9 +123,9 @@ if ($handle)
|
||||
|
||||
// Loop on each module find in opened directory
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
|
||||
{
|
||||
if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
|
||||
@ -143,25 +143,25 @@ if ($handle)
|
||||
print '<td nowrap="nowrap">'.$modCodeTiers->getExample($langs)."</td>\n";
|
||||
|
||||
if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print img_tick();
|
||||
print "</td>\n";
|
||||
}
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print img_tick();
|
||||
print "</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="societe.php?action=setcodeclient&value='.$file.'">'.$langs->trans("Activate").'</a></td>';
|
||||
}
|
||||
{
|
||||
print '<td align="center"><a href="societe.php?action=setcodeclient&value='.$file.'">'.$langs->trans("Activate").'</a></td>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
$s=$modCodeTiers->getToolTip($langs,$soc,-1);
|
||||
print $form->textwithhelp('',$s,1);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
$s=$modCodeTiers->getToolTip($langs,$soc,-1);
|
||||
print $form->textwithhelp('',$s,1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
closedir($handle);
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -188,11 +188,11 @@ $dir = "../includes/modules/societe/";
|
||||
$handle = opendir($dir);
|
||||
if ($handle)
|
||||
{
|
||||
$var = true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
|
||||
$var = true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
|
||||
@ -207,21 +207,21 @@ if ($handle)
|
||||
print '<td nowrap="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
|
||||
|
||||
if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
|
||||
{
|
||||
print '<td align="center">';
|
||||
print img_tick();
|
||||
print '</td>';
|
||||
}
|
||||
{
|
||||
print '<td align="center">';
|
||||
print img_tick();
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="societe.php?action=setcodecompta&value='.$file.'">'.$langs->trans("Activate").'</a></td>';
|
||||
{
|
||||
print '<td align="center"><a href="societe.php?action=setcodecompta&value='.$file.'">'.$langs->trans("Activate").'</a></td>';
|
||||
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
closedir($handle);
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
@ -245,17 +245,17 @@ print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("UseSearchToSelectCompany").'</td>';
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<td nowrap="nowrap" align="right" colspan="2">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
print '<td nowrap="nowrap" align="right" colspan="2">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="60" align="right">';
|
||||
print $html->selectyesno("activate_usesearchtoselectcompany",$conf->global->COMPANY_USE_SEARCH_TO_SELECT,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print '<td width="60" align="right">';
|
||||
print $html->selectyesno("activate_usesearchtoselectcompany",$conf->global->COMPANY_USE_SEARCH_TO_SELECT,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
}
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
@ -23,21 +23,21 @@
|
||||
/**
|
||||
\file htdocs/includes/modules/societe/modules_societe.class.php
|
||||
\ingroup societe
|
||||
\brief Fichier contenant la classe mère de module de generation societes
|
||||
\brief Fichier contenant la classe m<EFBFBD>re de module de generation societes
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleThirdPartyCode
|
||||
\brief Classe mère des modèles de numérotation des codes tiers
|
||||
\brief Classe m<EFBFBD>re des mod<EFBFBD>les de num<EFBFBD>rotation des codes tiers
|
||||
*/
|
||||
|
||||
class ModeleThirdPartyCode
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
/** \brief Renvoi la description par defaut du modele de num<EFBFBD>rotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info($langs)
|
||||
@ -55,7 +55,7 @@ class ModeleThirdPartyCode
|
||||
}
|
||||
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
/** \brief Renvoi un exemple de num<EFBFBD>rotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample($langs)
|
||||
@ -64,8 +64,8 @@ class ModeleThirdPartyCode
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
/** \brief Test si les num<EFBFBD>ros d<EFBFBD>j<EFBFBD> en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette num<EFBFBD>rotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
@ -73,7 +73,7 @@ class ModeleThirdPartyCode
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
/** \brief Renvoi prochaine valeur attribu<EFBFBD>e
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue($objsoc=0,$type=-1)
|
||||
@ -98,7 +98,7 @@ class ModeleThirdPartyCode
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
* \brief Renvoi la liste des mod<EFBFBD>les actifs
|
||||
* \param db Handler de base
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
@ -142,12 +142,12 @@ class ModeleThirdPartyCode
|
||||
if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
|
||||
$s.='<br>';
|
||||
$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
|
||||
if ($type == 0) $s.=$langs->trans("RequiredIfCustomer").': '.yn(!$this->code_null,1,1).'<br>';
|
||||
if ($type == 1) $s.=$langs->trans("RequiredIfSupplier").': '.yn(!$this->code_null,1,1).'<br>';
|
||||
if ($type == -1) $s.=$langs->trans("Required").': '.yn(!$this->code_null,1,1).'<br>';
|
||||
$s.=$langs->trans("CanBeModifiedIfOk").': '.yn($this->code_modifiable,1,1).'<br>';
|
||||
$s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,1).'<br>';
|
||||
$s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,1).'<br>';
|
||||
if ($type == 0) $s.=$langs->trans("RequiredIfCustomer").': '.yn(!$this->code_null,1,2).'<br>';
|
||||
if ($type == 1) $s.=$langs->trans("RequiredIfSupplier").': '.yn(!$this->code_null,1,2).'<br>';
|
||||
if ($type == -1) $s.=$langs->trans("Required").': '.yn(!$this->code_null,1,2).'<br>';
|
||||
$s.=$langs->trans("CanBeModifiedIfOk").': '.yn($this->code_modifiable,1,2).'<br>';
|
||||
$s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'<br>';
|
||||
$s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'<br>';
|
||||
$s.='<br>';
|
||||
if ($type == 0 || $type == -1) $s.=$langs->trans("NextValue").': <b>'.$this->getNextValue($soc,0).'</b><br>';
|
||||
if ($type == 1 || $type == -1) $s.=$langs->trans("NextValue").': <b>'.$this->getNextValue($soc,1).'</b>';
|
||||
@ -164,14 +164,14 @@ class ModeleThirdPartyCode
|
||||
|
||||
/**
|
||||
\class ModeleAccountancyCode
|
||||
\brief Classe mère des modèles de numérotation des codes compta
|
||||
\brief Classe m<EFBFBD>re des mod<EFBFBD>les de num<EFBFBD>rotation des codes compta
|
||||
*/
|
||||
|
||||
class ModeleAccountancyCode
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
/** \brief Renvoi la description par defaut du modele de num<EFBFBD>rotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info($langs)
|
||||
@ -180,7 +180,7 @@ class ModeleAccountancyCode
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
/** \brief Renvoi un exemple de num<EFBFBD>rotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample($langs)
|
||||
@ -189,8 +189,8 @@ class ModeleAccountancyCode
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
/** \brief Test si les num<EFBFBD>ros d<EFBFBD>j<EFBFBD> en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette num<EFBFBD>rotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
@ -198,7 +198,7 @@ class ModeleAccountancyCode
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
/** \brief Renvoi prochaine valeur attribu<EFBFBD>e
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue($langs)
|
||||
|
||||
@ -133,4 +133,6 @@ DescADHERENT_CARD_HEADER_TEXT=Text printed on top of member cards
|
||||
DescADHERENT_CARD_TEXT=Text printed on member cards
|
||||
DescADHERENT_CARD_FOOTER_TEXT=Text printed on bottom of member cards
|
||||
ShowTypeCard=Show type '%s'
|
||||
HTPasswordExport=htpassword file generation
|
||||
HTPasswordExport=htpassword file generation
|
||||
NoThirdPartyAssociatedToMember=No third party associated to this member
|
||||
ThirdPartyDolibarr=Dolibarr third party
|
||||
@ -70,6 +70,7 @@ UsersToAdd=Users to add to this group
|
||||
GroupsToAdd=Groups to add to this user
|
||||
NoLogin=No login
|
||||
CreateDolibarrLogin=Create Dolibarr account
|
||||
CreateDolibarrThirdParty=Create third party
|
||||
LoginAccountDisable=Account disabled, put a new login to activate it.
|
||||
LoginAccountDisableInDolibarr=Account disabled in Dolibarr.
|
||||
LoginAccountDisableInLdap=Account disabled in the domain.
|
||||
@ -94,5 +95,8 @@ UserDeleted=User %s removed
|
||||
NewGroupCreated=Group %s created
|
||||
GroupModified=Group %s modified
|
||||
GroupDeleted=Group %s removed
|
||||
ConfirmCreateContact=Are you sure yu want to create a Dolibarr account for this contact ?
|
||||
LoginToCreate=Login to create
|
||||
ConfirmCreateContact=Are you sure you want to create a Dolibarr account for this contact ?
|
||||
ConfirmCreateLogin=Are you sure you want to create a Dolibarr account for this member ?
|
||||
ConfirmCreateThirdParty=Are you sure you want to create a third party for this member ?
|
||||
LoginToCreate=Login to create
|
||||
NameToCreate=Name of third party to create
|
||||
@ -133,4 +133,6 @@ DescADHERENT_CARD_HEADER_TEXT=Texte imprimé sur le haut des cartes adhérents
|
||||
DescADHERENT_CARD_TEXT=Texte imprimé sur les cartes adhérents
|
||||
DescADHERENT_CARD_FOOTER_TEXT=Texte imprimé sur le bas des cartes adhérents
|
||||
ShowTypeCard=Voir type '%s'
|
||||
HTPasswordExport=Generation fichier htpassword
|
||||
HTPasswordExport=Generation fichier htpassword
|
||||
NoThirdPartyAssociatedToMember=Pas de tiers associé à cet adhérent
|
||||
ThirdPartyDolibarr=Tiers Dolibarr
|
||||
@ -70,6 +70,7 @@ UsersToAdd=Utilisateur à ajouter à ce groupe
|
||||
GroupsToAdd=Groupes à ajouter pour cet utilisateur
|
||||
NoLogin=Pas de login
|
||||
CreateDolibarrLogin=Créer un compte Dolibarr
|
||||
CreateDolibarrThirdParty=Créer un tiers
|
||||
LoginAccountDisable=Le compte est désactivé, mettre un nouveau login pour l'activer.
|
||||
LoginAccountDisableInDolibarr=Le compte est désactivé sur Dolibarr.
|
||||
LoginAccountDisableInLdap=Le compte est désactivé sur le domaine.
|
||||
@ -95,4 +96,7 @@ NewGroupCreated=Création groupe %s
|
||||
GroupModified=Modification groupe %s
|
||||
GroupDeleted=Suppression groupe %s
|
||||
ConfirmCreateContact=Etes vous sur de vouloir créer un compte Dolibarr pour ce contact ?
|
||||
LoginToCreate=Login à créer
|
||||
ConfirmCreateLogin=Etes vous sur de vouloir créer un compte Dolibarr pour cet adhérent ?
|
||||
ConfirmCreateThirdParty=Etes vous sur de vouloir créer un tiers pour cet adhérent ?
|
||||
LoginToCreate=Login à créer
|
||||
NameToCreate=Nom du tiers à créer
|
||||
@ -789,11 +789,12 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
|
||||
$newphone='<a href="'.$url.'">'.$newphone.'</a>';
|
||||
}
|
||||
|
||||
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
//if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$type='AC_TEL';
|
||||
if ($addlink == 'AC_FAX') $type='AC_FAX';
|
||||
$link='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
|
||||
$link='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode='.$type.($cid?'&contactid='.$cid:'').($socid?'&socid='.$socid:'').'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
|
||||
$newphone='<table class="nobordernopadding"><tr><td>'.$newphone.' </td><td> '.$link.'</td></tr></table>';
|
||||
}
|
||||
}
|
||||
@ -2265,10 +2266,10 @@ function get_default_npr($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoie oui ou non dans la langue choisie
|
||||
\param yesno Variable pour test si oui ou non
|
||||
\param case 1=Yes/No, 0=yes/no
|
||||
\param color 0=texte only, 1=Text is format with a color font style
|
||||
* \brief Renvoie oui ou non dans la langue choisie
|
||||
* \param yesno Variable pour test si oui ou non
|
||||
* \param case 1=Yes/No, 0=yes/no
|
||||
* \param color 0=texte only, 1=Text is formated with a color font style (red or blue), 2=Text is formated with blue color.
|
||||
*/
|
||||
function yn($yesno, $case=1, $color=0)
|
||||
{
|
||||
@ -2282,7 +2283,8 @@ function yn($yesno, $case=1, $color=0)
|
||||
elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false')
|
||||
{
|
||||
$result=($case?$langs->trans("No"):$langs->trans("no"));
|
||||
$class='error';
|
||||
if ($color == 2) $class='ok';
|
||||
else $class='error';
|
||||
}
|
||||
if ($color) return '<font class="'.$class.'">'.$result.'</font>';
|
||||
return $result;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -688,7 +688,7 @@ class Societe extends CommonObject
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
dolibarr_syslog("Societe::Delete");
|
||||
dolibarr_syslog("Societe::Delete", LOG_DEBUG);
|
||||
$sqr = 0;
|
||||
|
||||
// Check if third party can be deleted
|
||||
@ -746,6 +746,7 @@ class Societe extends CommonObject
|
||||
// Remove contacts
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
|
||||
$sql.= " WHERE fk_soc = " . $id;
|
||||
dolibarr_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$sqr++;
|
||||
@ -756,8 +757,24 @@ class Societe extends CommonObject
|
||||
dolibarr_syslog("Societe::Delete erreur -1 ".$this->error);
|
||||
}
|
||||
|
||||
// Update link in member table
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.= " SET fk_soc = NULL where fk_soc = " . $id;
|
||||
dolibarr_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$sqr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error .= $this->db->lasterror();
|
||||
dolibarr_syslog("Societe::Delete erreur -1 ".$this->error);
|
||||
}
|
||||
|
||||
// Remove ban
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql.= " WHERE fk_soc = " . $id;
|
||||
dolibarr_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$sqr++;
|
||||
@ -768,8 +785,10 @@ class Societe extends CommonObject
|
||||
dolibarr_syslog("Societe::Delete erreur -2 ".$this->error);
|
||||
}
|
||||
|
||||
// Remove third party
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."societe";
|
||||
$sql.= " WHERE rowid = " . $id;
|
||||
dolibarr_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$sqr++;
|
||||
@ -780,7 +799,7 @@ class Societe extends CommonObject
|
||||
dolibarr_syslog("Societe::Delete erreur -3 ".$this->error);
|
||||
}
|
||||
|
||||
if ($sqr == 3)
|
||||
if ($sqr == 4)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
@ -1935,6 +1954,68 @@ class Societe extends CommonObject
|
||||
|
||||
print '<input type="text" name="'.$htmlname.'" size="'.($formlength+1).'" maxlength="'.$formlength.'" value="'.$selected.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Cree en base un utilisateur depuis l'objet adherent
|
||||
* \param member Objet adherent source
|
||||
* \param login Login to force
|
||||
* \return int Si erreur <0, si ok renvoie id compte cree
|
||||
*/
|
||||
function create_from_member($member,$login='')
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$name=$member->societe;
|
||||
if (empty($name)) $name=strtolower($member->nom.' '.$member->prenom);
|
||||
|
||||
// Positionne parametres
|
||||
$this->email = $member->email;
|
||||
$this->nom = $name;
|
||||
$this->code_client = -1;
|
||||
$this->code_fournisseur = -1;
|
||||
$this->adresse=$member->adresse;
|
||||
$this->cp=$member->cp;
|
||||
$this->ville=$member->ville;
|
||||
$this->pays_code=$member->pays_code;
|
||||
$this->pays_id=$member->pays_id;
|
||||
$this->tel=$member->phone; // Prof phone
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Cree et positionne $this->id
|
||||
$result=$this->create($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.= " SET fk_soc=".$this->id;
|
||||
$sql.= " WHERE rowid=".$member->id;
|
||||
|
||||
dolibarr_syslog("Societe::create_from_member sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Societe::create_from_member - 1 - ".$this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// $this->error deja positionne
|
||||
dolibarr_syslog("Societe::create_from_member - 2 - ".$this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -868,9 +868,9 @@ class User extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " SET fk_member=".$member->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
|
||||
dolibarr_syslog("User::create_from_member sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -878,8 +878,8 @@ class User extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dolibarr_syslog("User::create_from_member - ".$this->error, LOG_ERR);
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("User::create_from_member - 1 - ".$this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
||||
@ -41,7 +41,10 @@ ALTER TABLE llx_product drop column stock_commande;
|
||||
|
||||
ALTER TABLE llx_adherent drop index login;
|
||||
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login);
|
||||
|
||||
ALTER TABLE llx_adherent add column fk_soc integer NULL after societe;
|
||||
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||
|
||||
ALTER TABLE llx_societe drop column rubrique;
|
||||
|
||||
|
||||
@ -20,3 +20,6 @@
|
||||
|
||||
|
||||
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login);
|
||||
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc);
|
||||
|
||||
ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user