Fix: mssql: récupération du dernière ID
Fix: le type d'entreprise et et son effectif n'était plus récupéré
This commit is contained in:
parent
e865d706fd
commit
45c98f1d0d
@ -573,13 +573,18 @@ class DoliDb
|
|||||||
*/
|
*/
|
||||||
function last_insert_id($tab)
|
function last_insert_id($tab)
|
||||||
{
|
{
|
||||||
return query("SELECT @@identity ");
|
$res = $this->query("SELECT @@IDENTITY as id");
|
||||||
|
if ($data = $this->fetch_array($res))
|
||||||
//return mssql_insert_id($this->db);
|
{
|
||||||
|
return $data["id"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Next function are not required. Only minor features use them.
|
// Next function are not required. Only minor features use them.
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -489,10 +489,10 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\n";
|
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\n";
|
||||||
$form->select_array("typent_id",$soc->typent_array(1), $soc->typent_id);
|
$form->select_array("typent_id",$soc->typent_array(0), $soc->typent_id);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$form->select_array("effectif_id",$soc->effectif_array(1), $soc->effectif_id);
|
$form->select_array("effectif_id",$soc->effectif_array(0), $soc->effectif_id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Assujeti TVA
|
// Assujeti TVA
|
||||||
@ -828,10 +828,10 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||||
$form->select_array("typent_id",$soc->typent_array(), $soc->typent_id);
|
$form->select_array("typent_id",$soc->typent_array(0), $soc->typent_id);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
$form->select_array("effectif_id",$soc->effectif_array(0), $soc->effectif_id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center" colspan="4">';
|
print '<tr><td align="center" colspan="4">';
|
||||||
|
|||||||
@ -1356,28 +1356,28 @@ class Societe
|
|||||||
*/
|
*/
|
||||||
function effectif_array($mode=0)
|
function effectif_array($mode=0)
|
||||||
{
|
{
|
||||||
$effs = array();
|
$effs = array();
|
||||||
|
|
||||||
$sql = "SELECT id, code, libelle";
|
$sql = "SELECT id, code, libelle";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||||
$sql .= " ORDER BY id ASC";
|
$sql .= " ORDER BY id ASC";
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows();
|
$objp = $this->db->fetch_object();
|
||||||
$i = 0;
|
if (! $mode) $key=$objp->id;
|
||||||
|
else $key=$objp->code;
|
||||||
|
|
||||||
while ($i < $num)
|
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
|
||||||
{
|
$i++;
|
||||||
$objp = $this->db->fetch_object();
|
|
||||||
if (! $mode) $key=$objp->id;
|
|
||||||
else $key=$objp->code;
|
|
||||||
|
|
||||||
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$this->db->free();
|
|
||||||
}
|
}
|
||||||
return $effs;
|
$this->db->free();
|
||||||
|
}
|
||||||
|
return $effs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user