Fix: bug #16141 : code compta aquarium

This commit is contained in:
Laurent Destailleur 2006-03-22 00:24:16 +00:00
parent dcdd61eb19
commit 1249e684f4
5 changed files with 15 additions and 14 deletions

View File

@ -63,25 +63,25 @@ class mod_codecompta_aquarium
$this->db = $DB;
// Regle gestion compte compta
if ($type == 'supplier') $codetouse=$societe->code_client;
if ($type == 'customer') $codetouse=$societe->code_fournisseur;
if ($type == 'customer') $codetouse=$societe->code_client;
if ($type == 'supplier') $codetouse=$societe->code_fournisseur;
if ($type == 'supplier') $this->code = "401".$codetouse;
if ($type == 'customer') $this->code = "411".$codetouse;
if ($type == 'supplier') $this->code = "401".$codetouse;
$is_dispo = $this->verif($DB, $this->code);
$is_dispo = $this->verif($DB, $this->code, $societe);
while ($is_dispo == 0 && $i < 37) // 40 char max
{
$arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$this->code = $societe->prefix_comm . $codetouse . substr($arr, $i, 1);
$is_dispo = $this->verif($DB, $this->code);
$is_dispo = $this->verif($DB, $this->code, $societe);
$i++;
}
dolibarr_debug("mod_codecompta_aquarium::get_code code=>".$this->code);
dolibarr_syslog("mod_codecompta_aquarium::get_code type=".$type." code=".$this->code);
return $is_dispo;
}
@ -90,10 +90,11 @@ class mod_codecompta_aquarium
* \brief Renvoi si un code compta est dispo
* \return int 0 non dispo, >0 dispo, <0 erreur
*/
function verif($db, $code)
function verif($db, $code, $societe)
{
$sql = "SELECT code_compta FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE code_compta = '".$code."'";
$sql.= " WHERE code_compta = '".$code."'";
$sql.= " AND idp != ".$societe->id;
if ($db->query($sql))
{

View File

@ -556,7 +556,7 @@ if ($_GET["id"] || $_GET["ref"])
// TVA
$langs->load("bills");
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.$product->tva_tx.' %</td></tr>';
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.$product->tva_tx.'%</td></tr>';
// Stock
if ($product->type == 0 && $conf->stock->enabled)

View File

@ -137,7 +137,7 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($_POST["action"] == 'update')
{
$result = $soc->update($socid,$user);
if ($result > 0)
if ($result >= 0)
{
Header("Location: soc.php?socid=".$socid);
exit;

View File

@ -370,7 +370,7 @@ class Societe
}
if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
$sql .= " WHERE idp = '" . $id ."'";
// Verifie que code compta défini
$resql=$this->db->query($sql);
@ -392,7 +392,7 @@ class Societe
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
// Doublon
$this->error = $langs->trans("ErrorPrefixAlreadyExists",$this->prefix_comm);
$this->error = $langs->trans("ErrorDuplicateField");
$result = -1;
}
else
@ -1261,7 +1261,7 @@ function set_price_level($price_level, $user)
/**
* \brief Renvoie un code compta, suivant le module de code compta.
* Peut être identique à celui saisit ou généré automatiquement.
* A ce jour seul la génération automatique est implémentée
* A ce jour seule la génération automatique est implémentée
* \param type Type de tiers ('customer' ou 'supplier')
*/
function get_codecompta($type)

View File

@ -60,7 +60,7 @@ insert into llx_const (name, value, type, note, visible) values ('COMPTA_ONLINE_
-- IHM
--
insert into llx_const (name, value, type, note, visible) values ('MAIN_THEME','eldy','chaine','Thème par défaut',0);
insert into llx_const (name, value, type, note, visible) values ('SIZE_LISTE_LIMIT','20','chaine','Taille des listes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_SIZE_LISTE_LIMIT','20','chaine','Taille des listes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_BARRETOP','default.php','chaine','Module de gestion de la barre de menu du haut',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_LANG_DEFAULT','fr_FR','chaine','Langue par défaut pour les écrans Dolibarr',0);