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 '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; 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>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';

View File

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

View File

@ -103,7 +103,7 @@ print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">'; 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>'; print '</td></tr>';
if ($conf->banque->enabled) if ($conf->banque->enabled)
{ {

View File

@ -93,7 +93,7 @@ print '<td>';
$disabled=0; $disabled=0;
$langs->load("companies"); $langs->load("companies");
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice 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 '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

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

View File

@ -287,7 +287,7 @@ if ($action == 'create')
// Company // Company
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("CompanyVisited").'</td><td>'; 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>'; print '</td></tr>';
// Public note // Public note
@ -375,7 +375,7 @@ else if ($id)
// Where // Where
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("CompanyVisited").'</td><td>'; 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>'; print '</td></tr>';
// Public note // Public note

View File

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

View File

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

View File

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

View File

@ -918,7 +918,7 @@ if ($action == 'create')
} }
else 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>'; print '</td>';

View File

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

View File

@ -414,7 +414,7 @@ else
// Customer // Customer
print '<tr><td>'.$langs->trans("Company").'</td><td>'; 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>'; print '</td></tr>';
// Visibility // Visibility