Qual: Remove a deprecated page, replaced by a more direct combo box.
This commit is contained in:
parent
c6b66a9f4a
commit
7d2b11aff5
@ -660,7 +660,7 @@ class Form
|
||||
*
|
||||
* @param string $selected Preselected type
|
||||
* @param string $htmlname Name of field in form
|
||||
* @param string $filter Optionnal filters criteras
|
||||
* @param string $filter Optionnal filters criteras (example: 's.rowid <> x')
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
|
||||
@ -148,14 +148,6 @@ function societe_prepare_head2($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))
|
||||
{
|
||||
$head[$h][0] = 'lien.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ParentCompany");
|
||||
$head[$h][2] = 'links';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = 'commerciaux.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("SalesRepresentative");
|
||||
$head[$h][2] = 'salesrepresentative';
|
||||
|
||||
@ -195,11 +195,7 @@ for ($i=1; $i<=4; $i++) {
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('ParentCompany'); ?></td>
|
||||
<td align="right">
|
||||
<?php if ($user->rights->societe->creer) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/societe/lien.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -129,6 +129,7 @@ class Societe extends CommonObject
|
||||
var $date_update;
|
||||
|
||||
var $commercial_id; // Id of sales representative to link (used for thirdparty creation). Not filled by a fetch, because we can have several sales representatives.
|
||||
var $parent;
|
||||
var $default_lang;
|
||||
|
||||
var $ref_int;
|
||||
@ -1975,53 +1976,30 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Defini la societe mere pour les filiales
|
||||
* Define parent commany of current company
|
||||
*
|
||||
* @param int $id id compagnie mere a positionner
|
||||
* @param int $id Id of thirdparty to set or '' to remove
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_parent($id)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||
$sql .= " SET parent = ".$id;
|
||||
$sql .= " WHERE rowid = " . $this->id .";";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
||||
$sql.= " SET parent = ".($id > 0 ? $id : "null");
|
||||
$sql.= " WHERE rowid = " . $this->id;
|
||||
dol_syslog(get_class($this).'::set_parent sql='.$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprime la societe mere
|
||||
*
|
||||
* @param int $id id compagnie mere a effacer
|
||||
* @return int <0 if KO, >0 if KO
|
||||
*/
|
||||
function remove_parent($id)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||
$sql .= " SET parent = null";
|
||||
$sql .= " WHERE rowid = " . $this->id .";";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,342 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/lien.php
|
||||
* \ingroup societe
|
||||
* \brief Page of links to other third parties
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("customers");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("banks");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe','','');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Positionne companie parente
|
||||
if ($socid && $_GET["select"])
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $_GET["socid"];
|
||||
$soc->fetch($_GET["socid"]);
|
||||
$soc->set_parent($_GET["select"]);
|
||||
|
||||
header("Location: lien.php?socid=".$soc->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: lien.php?socid=".$_GET["socid"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Supprime companie parente
|
||||
if ($socid && $_GET["delsocid"])
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $_GET["socid"];
|
||||
$soc->fetch($_GET["socid"]);
|
||||
$soc->remove_parent($_GET["delsocid"]);
|
||||
|
||||
header("Location: lien.php?socid=".$soc->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: lien.php?socid=".$_GET["socid"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
|
||||
$head=societe_prepare_head2($soc);
|
||||
|
||||
dol_fiche_head($head, 'links', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
/*
|
||||
* Fiche societe en mode visu
|
||||
*/
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('CustomerCode').'</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>';
|
||||
print $soc->code_client;
|
||||
if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
|
||||
print '</td>';
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->address)."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans('Zip').'</td><td width="20%">'.$soc->zip."</td>";
|
||||
print "<td>".$langs->trans('Town')."</td><td>".$soc->town."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans('Country')."</td><td colspan=\"3\">".$soc->country."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
|
||||
print '</td></tr>';
|
||||
|
||||
$object=$soc;
|
||||
print '<tr>';
|
||||
// IdProf1 (SIREN for France)
|
||||
$idprof=$langs->transcountry('ProfId1',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $object->idprof1;
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf2 (SIRET for France)
|
||||
$idprof=$langs->transcountry('ProfId2',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $object->idprof2;
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
// IdProf3 (APE for France)
|
||||
$idprof=$langs->transcountry('ProfId3',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $object->idprof3;
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf4 (NU for France)
|
||||
$idprof=$langs->transcountry('ProfId4',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $object->idprof4;
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Capital
|
||||
print '<tr><td>'.$langs->trans("Capital").'</td><td colspan="3">'.$soc->capital.' '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
// Societe mere
|
||||
print '<tr><td>'.$langs->trans("ParentCompany").'</td><td colspan="3">';
|
||||
if ($soc->parent)
|
||||
{
|
||||
$socm = new Societe($db);
|
||||
$socm->fetch($soc->parent);
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$socm->id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?" (".$socm->code_client.")":"");
|
||||
print ($socm->town?' - '.$socm->town:'');
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?socid='.$_GET["socid"].'&delsocid='.$socm->id.'">';
|
||||
print img_delete();
|
||||
print '</a><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoParentCompany");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
if ($_GET["select"] > 0)
|
||||
{
|
||||
$socm = new Societe($db);
|
||||
$socm->id = $_GET["select"];
|
||||
$socm->fetch($_GET["select"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$page=$_GET["page"];
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
/*
|
||||
* Liste
|
||||
*
|
||||
*/
|
||||
|
||||
$title=$langs->trans("CompanyList");
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom, s.town, s.prefix_comm, s.client, s.fournisseur,";
|
||||
$sql.= " te.code, te.libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_typent as te";
|
||||
if (! $user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fk_typent = te.id";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
if (! $user->rights->societe->client->voir) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (dol_strlen(trim($_GET["search_nom"]))) $sql.= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
|
||||
$sql.= $db->order("s.nom","ASC");
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$params = "&socid=".$_GET["socid"];
|
||||
|
||||
print_barre_liste($title, $page, "lien.php",$params,$sortfield,$sortorder,'',$num,0,'');
|
||||
|
||||
// Lignes des titres
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td>'.$langs->trans("ThirdPartyType").'<td>';
|
||||
print '<td colspan="2" align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form action="lien.php" method="GET" >';
|
||||
print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td valign="right">';
|
||||
print '<input type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
|
||||
print '</td>';
|
||||
print '<td colspan="4" align="right">';
|
||||
print '<input type="image" name="button_search" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>";
|
||||
$societestatic->name=$obj->nom;
|
||||
$societestatic->id=$obj->socid;
|
||||
print $societestatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print "<td>".$obj->town." </td>\n";
|
||||
print "<td>";
|
||||
$s=$langs->getLabelFromKey($db,$obj->code,'c_typent','code','libelle');
|
||||
if ($s != '-') print $s;
|
||||
print "</td>\n";
|
||||
print '<td align="center">';
|
||||
$x=0;
|
||||
if ($obj->client==1 || $obj->client==3)
|
||||
{
|
||||
print $langs->trans("Customer");
|
||||
$x++;
|
||||
}
|
||||
if ($obj->client==2)
|
||||
{
|
||||
if ($x) print '/';
|
||||
print $langs->trans("Prospect");
|
||||
$x++;
|
||||
}
|
||||
if ($obj->fournisseur)
|
||||
{
|
||||
if ($x) print '/';
|
||||
print $langs->trans("Supplier");
|
||||
$x++;
|
||||
}
|
||||
print '</td>';
|
||||
// Lien S<>lectionner
|
||||
print '<td align="center"><a href="lien.php?socid='.$_GET["socid"].'&select='.$obj->socid.'">'.$langs->trans("Add").'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -442,6 +442,11 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Set parent company
|
||||
if ($action == 'set_thirdparty' && $user->rights->societe->creer)
|
||||
{
|
||||
$result = $object->set_parent(GETPOST('editparentcompany','int'));
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate document
|
||||
@ -515,7 +520,6 @@ $formcompany = new FormCompany($db);
|
||||
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
{
|
||||
// -----------------------------------------
|
||||
@ -1724,28 +1728,24 @@ else
|
||||
// Parent company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('ParentCompany');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer)
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/lien.php?socid='.$object->id.'">'.img_edit() .'</a>';
|
||||
else
|
||||
print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($object->parent)
|
||||
{
|
||||
$socm = new Societe($db);
|
||||
$socm->fetch($object->parent);
|
||||
print $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":"");
|
||||
print $socm->town?' - '.$socm->town:'';
|
||||
}
|
||||
else {
|
||||
print $langs->trans("NoParentCompany");
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('ParentCompany');
|
||||
print '</td>';
|
||||
if ($action != 'editparentcompany') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editparentcompany')
|
||||
{
|
||||
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'editparentcompany','s.rowid <> '.$object->id,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'none','s.rowid <> '.$object->id,1);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Sales representative
|
||||
|
||||
Loading…
Reference in New Issue
Block a user