Fix: print select_societe was wrong as it contains already print

instructions. Use select_company instead.
This commit is contained in:
Laurent Destailleur 2012-02-20 12:41:12 +01:00
parent 8c0ad673e8
commit 58d1a042a5
12 changed files with 32 additions and 48 deletions

View File

@ -563,7 +563,7 @@ if ($rowid)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print $form->select_societes($adh->fk_soc,'socid','',1);
print $form->select_company($adh->fk_soc,'socid','',1);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';

View File

@ -789,7 +789,7 @@ if ($action == 'create')
if ($conf->societe->enabled)
{
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td class="valeur">';
print $form->select_societes($object->fk_soc,'socid','',1);
print $form->select_company($object->fk_soc,'socid','',1);
print '</td></tr>';
}
@ -1336,7 +1336,7 @@ if ($rowid && $action != 'edit')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print $form->select_societes($object->fk_soc,'socid','',1);
print $form->select_company($object->fk_soc,'socid','',1);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';

View File

@ -103,7 +103,7 @@ print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,1);
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,1);
print '</td></tr>';
if ($conf->banque->enabled)
{

View File

@ -93,7 +93,7 @@ print '<td>';
$disabled=0;
$langs->load("companies");
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
$form->select_societes(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
print $form->select_company(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";

View File

@ -523,7 +523,7 @@ if ($action == 'create')
}
else
{
print $form->select_societes('','socid','',1,1);
print $form->select_company('','socid','',1,1);
}
print '</td></tr>';
@ -742,7 +742,7 @@ if ($id)
// Company
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
print '<td>';
print $form->select_societes($act->societe->id,'socid','',1,1);
print $form->select_company($act->societe->id,'socid','',1,1);
print '</td>';
// Contact

View File

@ -287,7 +287,7 @@ if ($action == 'create')
// Company
print "<tr>";
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
print $form->select_societes(GETPOST("socid"),'socid','',1);
print $form->select_company(GETPOST("socid"),'socid','',1);
print '</td></tr>';
// Public note
@ -375,7 +375,7 @@ else if ($id)
// Where
print "<tr>";
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
print $form->select_societes($soc->id,'socid','',1);
print $form->select_company($soc->id,'socid','',1);
print '</td></tr>';
// Public note

View File

@ -389,9 +389,7 @@ else
}
else {
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print $form->select_societes(isset($_POST["socid"])?$_POST["socid"]:'','socid','',1);
//print $form->select_societes('','socid','');
//print $langs->trans("ContactNotLinkedToCompany");
print $form->select_company(GETPOST("socid"),'socid','',1);
print '</td></tr>';
}
}
@ -563,7 +561,7 @@ else
{
print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td colspan="3">';
print $form->select_societes(isset($_POST["socid"])?$_POST["socid"]:($object->socid?$object->socid:-1),'socid','',1);
print $form->select_company(GETPOST("socid")?GETPOST("socid"):($object->socid?$object->socid:-1),'socid','',1);
print '</td>';
print '</tr>';
}

View File

@ -609,28 +609,13 @@ class Form
/**
* Output html form to select a third party
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param string $filter Optionnal filters criteras
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param string $filter Optionnal filters criteras
* @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
* @return void
*/
function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
{
print $this->select_company($selected,$htmlname,$filter,$showempty,$showtype,$forcecombo);
}
/**
* Output html form to select a third party
*
* @param selected Preselected type
* @param htmlname Name of field in form
* @param filter Optionnal filters criteras
* @param showempty Add an empty field
* @param showtype Show third party type in combolist (customer, prospect or supplier)
* @param forcecombo Force to use combo box
* @return string HTML string with
*/
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
{
@ -647,7 +632,7 @@ class Form
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY nom ASC";
dol_syslog("Form::select_societes sql=".$sql);
dol_syslog(get_class($this)."::select_company sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
@ -2649,11 +2634,11 @@ class Form
}
/**
* Affiche formulaire de selection des tiers
* Output html select to select thirdparty
*
* @param page Page
* @param selected Id contact pre-selectionne
* @param htmlname Nom du formulaire select
* @param string $page Page
* @param string $selected Id preselected
* @param string $htmlname Name of HTML select
* @return void
*/
function form_thirdparty($page, $selected='', $htmlname='socid')
@ -2667,7 +2652,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$num=$this->select_societes($selected , $htmlname);
print $this->select_company($selected , $htmlname);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
@ -2680,7 +2665,9 @@ class Form
$soc = new Societe($this->db);
$soc->fetch($selected);
print $soc->getNomUrl($langs);
} else {
}
else
{
print "&nbsp;";
}
}

View File

@ -741,7 +741,7 @@ if ($action == 'create')
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
$form->select_societes('','socid','',1,1);
print $form->select_company('','socid','',1,1);
print '</td></tr>';
print '</table>';

View File

@ -5,17 +5,17 @@
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
*
* 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 2 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/>.
*/
@ -918,7 +918,7 @@ if ($action == 'create')
}
else
{
$form->select_societes((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1);
print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1);
}
print '</td>';
@ -1254,7 +1254,7 @@ else
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>';
print '<td colspan="3">'.$form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>';
/*
* List of payments
*/

View File

@ -273,8 +273,7 @@ if ($id || $ref)
}
else
{
$form=new Form($db);
$form->select_societes($_POST["id_fourn"],'id_fourn','fournisseur=1',1);
print $form->select_company($_POST["id_fourn"],'id_fourn','fournisseur=1',1);
}
print '</td></tr>';

View File

@ -414,7 +414,7 @@ else
// Customer
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print $form->select_societes($project->societe->id,'socid','',1,1);
print $form->select_company($project->societe->id,'socid','',1,1);
print '</td></tr>';
// Visibility