On rend bouton selection contact inactif si aucun contact défini.
This commit is contained in:
parent
5371e6bb5b
commit
fa5d822e76
@ -272,12 +272,15 @@ if ($id > 0)
|
|||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
// On récupère les id des contacts déjà sélectionnés
|
||||||
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$propal->selectTypeContact($propal, '', 'type','external');
|
$propal->selectTypeContact($propal, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -274,12 +274,15 @@ if ($id > 0)
|
|||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
// On récupère les id des contacts déjà sélectionnés
|
||||||
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$commande->selectTypeContact($commande, '', 'type','external');
|
$commande->selectTypeContact($commande, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -786,8 +786,8 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||||||
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Contact de la commande
|
* Contact de la commande
|
||||||
*/
|
*/
|
||||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||||
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
|
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -254,12 +253,15 @@ if ($id > 0)
|
|||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
// On récupère les id des contacts déjà sélectionnés
|
||||||
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$facture->selectTypeContact($facture, '', 'type','external');
|
$facture->selectTypeContact($facture, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -275,12 +275,15 @@ if ($id > 0)
|
|||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
// On récupère les id des contacts déjà sélectionnés
|
||||||
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$contrat->selectTypeContact($contrat, '', 'type','external');
|
$contrat->selectTypeContact($contrat, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.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
|
||||||
@ -259,12 +260,15 @@ if ($id > 0)
|
|||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
// On récupère les id des contacts déjà sélectionnés
|
||||||
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fichinter->selectTypeContact($fichinter, '', 'type','external');
|
$fichinter->selectTypeContact($fichinter, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -18,8 +18,6 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -792,65 +792,65 @@ class Form
|
|||||||
* \param htmlname Nom champ formulaire ('none' pour champ non editable)
|
* \param htmlname Nom champ formulaire ('none' pour champ non editable)
|
||||||
* \param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
* \param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||||
* \param exclude Liste des id contacts à exclure
|
* \param exclude Liste des id contacts à exclure
|
||||||
* \return int <0 si ko, >=0 si ok
|
* \return int <0 if KO, Nb of contact in list if OK
|
||||||
*/
|
*/
|
||||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='')
|
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='')
|
||||||
{
|
{
|
||||||
// Permettre l'exclusion de contacts
|
// Permettre l'exclusion de contacts
|
||||||
if (is_array($exclude))
|
if (is_array($exclude))
|
||||||
{
|
{
|
||||||
$excludeContacts = implode("','",$exclude);
|
$excludeContacts = implode("','",$exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On recherche les societes
|
// On recherche les societes
|
||||||
$sql = "SELECT s.rowid, s.name, s.firstname FROM";
|
$sql = "SELECT s.rowid, s.name, s.firstname FROM";
|
||||||
$sql.= " ".MAIN_DB_PREFIX ."socpeople as s";
|
$sql.= " ".MAIN_DB_PREFIX ."socpeople as s";
|
||||||
$sql.= " WHERE fk_soc=".$socid;
|
$sql.= " WHERE fk_soc=".$socid;
|
||||||
if (is_array($exclude) && $excludeContacts) $sql.= " AND s.rowid NOT IN ('".$excludeContacts."')";
|
if (is_array($exclude) && $excludeContacts) $sql.= " AND s.rowid NOT IN ('".$excludeContacts."')";
|
||||||
$sql.= " ORDER BY s.name ASC";
|
$sql.= " ORDER BY s.name ASC";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num=$this->db->num_rows();
|
$num=$this->db->num_rows($resql);
|
||||||
if ($num==0) return 0;
|
if ($num == 0) return 0;
|
||||||
|
|
||||||
if ($htmlname != 'none') print '<select class="flat" name="'.$htmlname.'">';
|
if ($htmlname != 'none') print '<select class="flat" name="'.$htmlname.'">';
|
||||||
if ($showempty) print '<option value="1"> </option>';
|
if ($showempty) print '<option value="1"> </option>';
|
||||||
$num = $this->db->num_rows();
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object();
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($htmlname != 'none')
|
if ($htmlname != 'none')
|
||||||
{
|
{
|
||||||
if ($selected && $selected == $obj->rowid)
|
if ($selected && $selected == $obj->rowid)
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->rowid.'" selected="true">'.$obj->name.' '.$obj->firstname.'</option>';
|
print '<option value="'.$obj->rowid.'" selected="true">'.$obj->name.' '.$obj->firstname.'</option>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<option value="'.$obj->rowid.'">'.$obj->name.' '.$obj->firstname.'</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($selected == $obj->rowid) print $obj->name.' '.$obj->firstname;
|
print '<option value="'.$obj->rowid.'">'.$obj->name.' '.$obj->firstname.'</option>';
|
||||||
}
|
}
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($selected == $obj->rowid) print $obj->name.' '.$obj->firstname;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
if ($htmlname != 'none') print '</select>';
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else
|
if ($htmlname != 'none') print '</select>';
|
||||||
{
|
return $num;
|
||||||
dolibarr_print_error($this->db);
|
}
|
||||||
return -1;
|
else
|
||||||
}
|
{
|
||||||
}
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -125,6 +125,7 @@ Supplier=Supplier
|
|||||||
CompanyList=Companies' list
|
CompanyList=Companies' list
|
||||||
AddContact=Add contact
|
AddContact=Add contact
|
||||||
Contact=Contact
|
Contact=Contact
|
||||||
|
NoContactDefined=No contact defined for this third party
|
||||||
DefaultContact=Default contact
|
DefaultContact=Default contact
|
||||||
AddCompany=Add company
|
AddCompany=Add company
|
||||||
AddThirdParty=Add third party
|
AddThirdParty=Add third party
|
||||||
|
|||||||
@ -125,6 +125,7 @@ Supplier=Fournisseur
|
|||||||
CompanyList=Liste des sociétés
|
CompanyList=Liste des sociétés
|
||||||
AddContact=Créer contact
|
AddContact=Créer contact
|
||||||
Contact=Contact
|
Contact=Contact
|
||||||
|
NoContactDefined=Aucun contact défini pour ce tiers
|
||||||
DefaultContact=Contact par défaut
|
DefaultContact=Contact par défaut
|
||||||
AddCompany=Créer société
|
AddCompany=Créer société
|
||||||
AddThirdParty=Créer tiers
|
AddThirdParty=Créer tiers
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user