On rend bouton selection contact inactif si aucun contact défini.

This commit is contained in:
Laurent Destailleur 2007-11-04 18:34:16 +00:00
parent 5371e6bb5b
commit fa5d822e76
10 changed files with 83 additions and 68 deletions

View File

@ -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>";

View File

@ -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>";

View File

@ -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>";

View File

@ -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>";

View File

@ -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>";

View File

@ -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$
*
*/ */
/** /**

View File

@ -792,7 +792,7 @@ 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='')
{ {
@ -812,18 +812,18 @@ class Form
$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">&nbsp;</option>'; if ($showempty) print '<option value="1">&nbsp;</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)
@ -843,7 +843,7 @@ class Form
} }
} }
if ($htmlname != 'none') print '</select>'; if ($htmlname != 'none') print '</select>';
return 1; return $num;
} }
else else
{ {

View File

@ -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

View File

@ -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