diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 43b85924d25efa9ef772ca7d672acf096ff430a0..c16653b5f9f4db89eca627454a5a7ee352cc752c 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -215,11 +215,28 @@ if ($_socid > 0) print $objsoc->nom; print '</td></tr>'; - print '<tr><td>'; - print $langs->trans('CustomerCode').'</td><td>'; - print $objsoc->code_client; - if ($objsoc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); - print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$objsoc->prefix_comm.'</td></tr>'; + print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$objsoc->prefix_comm.'</td></tr>'; + + if ($objsoc->client) { + print '<tr><td>'; + print $langs->trans('CustomerCode').'</td><td colspan="3">'; + print $objsoc->code_client; + if ($objsoc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); + print '</td></tr>'; + print '<tr>'; + print '<td nowrap>'.$langs->trans("CustomerAccountancyCode").'</td><td colspan="3">'.$societe->code_compta.'</td>'; + print '</tr>'; + } + + /* + if ($objsoc->fournisseur) { + print '<tr><td>'; + print $langs->trans('SupplierCode').'</td><td colspan="3">'; + print $objsoc->code_fournisseur; + if ($objsoc->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode"); + print '</td></tr>'; + } + */ print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($objsoc->adresse)."</td></tr>"; @@ -236,8 +253,15 @@ if ($_socid > 0) print "<tr><td nowrap>".$langs->transcountry("ProfId1",$objsoc->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$objsoc->siren."\">".$objsoc->siren."</a> </td>"; print '<td>'.$langs->transcountry('ProfId2',$objsoc->pays_code).'</td><td>'.$objsoc->siret.'</td></tr>'; - print '<tr><td nowrap>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$objsoc->forme_juridique.'</td></tr>'; - print '<tr><td>'.$langs->trans("Type").'</td><td>'.$objsoc->typent.'</td><td>'.$langs->trans("Effectif").'</td><td>'.$objsoc->effectif.'</td></tr>'; + print '<tr><td>'.$langs->transcountry('ProfId3',$objsoc->pays_code).'</td><td>'.$objsoc->ape.'</td><td colspan="2"> </td></tr>'; + + // Statut juridique + print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$objsoc->forme_juridique.'</td></tr>'; + + // Type + Staff + $arr = $objsoc->typent_array($objsoc->typent_id); + $objsoc->typent= $arr[$objsoc->typent_id]; + print '<tr><td>'.$langs->trans("Type").'</td><td>'.$objsoc->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$objsoc->effectif.'</td></tr>'; print '<tr><td nowrap>'; print $langs->trans("CustomerDiscount").'</td><td>'.$objsoc->remise_client." %</td>"; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c3c8fd242ae8e05f93e8767691e86943bc188966..c839aebc3244349ebde164fdcf80abee248f37c7 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -199,9 +199,12 @@ if ($_POST['action'] == 'send') $filepath[0] = $file; $filename[0] = $propal->ref.'.pdf'; $mimetype[0] = 'application/pdf'; - $filepath[1] = $_FILES['addedfile']['tmp_name']; - $filename[1] = $_FILES['addedfile']['name']; - $mimetype[1] = $_FILES['addedfile']['type']; + if ($_FILES['addedfile']['tmp_name']) + { + $filepath[1] = $_FILES['addedfile']['tmp_name']; + $filename[1] = $_FILES['addedfile']['name']; + $mimetype[1] = $_FILES['addedfile']['type']; + } // Envoi de la facture $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc); if ($mailfile->sendfile()) @@ -233,7 +236,7 @@ if ($_POST['action'] == 'send') } else { - $msg='<div class="error">'.$langs->trans('ErrorFailedToSendMail',$from,$sendto).' !</div>'; + $msg='<div class="error">'.$langs->trans('ErrorFailedToSendMail',$from,$sendto).' - '.$actioncomm->error.'</div>'; } } else diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index 7b3ea144c85bad5396927deb4bbc39a33fed269a..f7ec17043757d3f7ac7376df800a2a2cdae0a457 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -200,7 +200,31 @@ if ($socid > 0) print '<tr><td valign="top" width="50%">'; print '<table class="border" width="100%">'; - print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; + + print '<tr><td>'.$langs->trans("Name").'</td><td colspan="3">'.$societe->nom.'</td></tr>'; + + print '<td>'.$langs->trans("Prefix").'</td><td colspan="3">'; + print ($societe->prefix_comm?$societe->prefix_comm:' '); + print '</td>'; + + if ($societe->client) { + print '<tr>'; + print '<td nowrap width="100">'.$langs->trans("CustomerCode"). '</td><td colspan="3">'. $societe->code_client . '</td>'; + print '</tr>'; + print '<tr>'; + print '<td nowrap>'.$langs->trans("CustomerAccountancyCode").'</td><td colspan="3">'.$societe->code_compta.'</td>'; + print '</tr>'; + } + + if ($societe->fournisseur) { + print '<tr>'; + print '<td nowrap>'.$langs->trans("SupplierCode"). '</td><td colspan="3">'. $societe->code_fournisseur . '</td>'; + print '</tr>'; + print '<tr>'; + print '<td nowrap>'.$langs->trans("SupplierAccountancyCode").'</td><td colspan="3">'.$societe->code_compta_fournisseur.'</td>'; + print '</tr>'; + } + print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse)."</td></tr>"; print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$societe->cp.'</td>'; @@ -208,22 +232,23 @@ if ($socid > 0) print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$societe->pays.'</td></tr>'; - print '<tr><td>'.$langs->trans("Phone").'</td><td>'.$societe->tel.' </td><td>Fax</td><td>'.$societe->fax.' </td></tr>'; + print '<tr><td>'.$langs->trans("Phone").'</td><td>'.$societe->tel.' </td><td>'.$langs->trans("Fax").'</td><td>'.$societe->fax.' </td></tr>'; print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; - print '<tr><td nowrap>'.$langs->transcountry("ProfId1",$societe->pays_code).'</td><td><a href="http://www.societe.com/cgi-bin/recherche?rncs='.$societe->siren.'">'.$societe->siren.'</a> </td>'; - print '<td>'.$langs->trans("Prefix").'</td><td>'; - if ($societe->prefix_comm) - { - print $societe->prefix_comm; - } + print "<tr><td nowrap>".$langs->transcountry("ProfId1",$societe->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$societe->siren."\">".$societe->siren."</a> </td>"; + print '<td>'.$langs->transcountry('ProfId2',$societe->pays_code).'</td><td>'.$societe->siret.'</td></tr>'; - print "</td></tr>"; + print '<tr><td>'.$langs->transcountry('ProfId3',$societe->pays_code).'</td><td>'.$societe->ape.'</td><td colspan="2"> </td></tr>'; - print '<tr><td nowrap>'.$langs->trans("AccountancyCode").'</td><td>'.$societe->code_compta.'</td>'; - print '<td>'.$langs->trans("CustomerCode").' / ' . $langs->trans("SupplierCode") . '</td><td>'; - print $societe->code_client; - print "</td></tr>"; + // Statut juridique + print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; + + // Type + Staff + $arr = $societe->typent_array($societe->typent_id); + $societe->typent= $arr[$societe->typent_id]; + print '<tr><td>'.$langs->trans("Type").'</td><td>'.$societe->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$societe->effectif.'</td></tr>'; + + print '</tr>'; print "</table>"; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 94f14f2961af3ab8078ed8c6ebfa8db58a7ec5da..d2c0585989e23828574612cd1ea5c1cbd6d95604 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -123,6 +123,30 @@ if ( $societe->fetch($socid) ) print '<table class="border" width="100%">'; print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; + + print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>'; + + /* + if ($societe->client) { + print '<tr><td>'; + print $langs->trans('CustomerCode').'</td><td colspan="3">'; + print $societe->code_client; + if ($societe->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); + print '</td></tr>'; + } + */ + + if ($societe->fournisseur) { + print '<tr><td>'; + print $langs->trans('SupplierCode').'</td><td colspan="3">'; + print $societe->code_fournisseur; + if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode"); + print '</td></tr>'; + print '<tr>'; + print '<td nowrap>'.$langs->trans("SupplierAccountancyCode").'</td><td colspan="3">'.$societe->code_compta_fournisseur.'</td>'; + print '</tr>'; + } + print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse).'</td></tr>'; print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>'; @@ -131,6 +155,19 @@ if ( $societe->fetch($socid) ) print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dolibarr_print_phone($societe->tel).' </td><td>'.$langs->trans("Fax").'</td><td>'.dolibarr_print_phone($societe->fax).' </td></tr>'; print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; + print "<tr><td nowrap>".$langs->transcountry("ProfId1",$societe->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$societe->siren."\">".$societe->siren."</a> </td>"; + print '<td>'.$langs->transcountry('ProfId2',$societe->pays_code).'</td><td>'.$societe->siret.'</td></tr>'; + + print '<tr><td>'.$langs->transcountry('ProfId3',$societe->pays_code).'</td><td>'.$societe->ape.'</td><td colspan="2"> </td></tr>'; + + // Statut juridique + print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; + + // Type + Staff + $arr = $societe->typent_array($societe->typent_id); + $societe->typent= $arr[$societe->typent_id]; + print '<tr><td>'.$langs->trans("Type").'</td><td>'.$societe->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$societe->effectif.'</td></tr>'; + print '</table>'; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 0b657b60691f64845802c829ce4e6d7163f966ef..5ed2bb984a69a44d35e9a805d2e4529621694be7 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -36,4 +36,6 @@ DatePayment=Payment date NewVATPayment=New VAT payment VATPayment=VAT Payment VATPayments=VAT Payments -TotalToPay=Total to pay \ No newline at end of file +TotalToPay=Total to pay +CustomerAccountancyCode=Customer accountancy code +SupplierAccountancyCode=Supplier accountacy code \ No newline at end of file diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 883227e6cfb55165ab646edcde025e6c48f7bdc9..334bc20721669e63040c4e996be9c1f24365685b 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -37,4 +37,6 @@ DatePayment=Date paiement NewVATPayment=Nouveau paiment de TVA VATPayment=R�glement TVA VATPayments=R�glements TVA -TotalToPay=Total � payer \ No newline at end of file +TotalToPay=Total � payer +CustomerAccountancyCode=Code compta client +SupplierAccountancyCode=Code compta founisseur \ No newline at end of file diff --git a/htdocs/soc.php b/htdocs/soc.php index e052b489295654999e35b2d7632187163fca190f..22cad0c3818e55e4057772bbd1ca9e1800dd691b 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -71,7 +71,9 @@ if (($_POST["action"] == 'add' && (! defined("COMPANY_CREATE_TWO_STEPS") || $ste $soc->ape = stripslashes($_POST["ape"]); $soc->prefix_comm = stripslashes($_POST["prefix_comm"]); $soc->code_client = stripslashes($_POST["code_client"]); + $soc->code_fournisseur = stripslashes($_POST["code_fournisseur"]); $soc->codeclient_modifiable = stripslashes($_POST["codeclient_modifiable"]); + $soc->codefournisseur_modifiable = stripslashes($_POST["codefournisseur_modifiable"]); $soc->capital = stripslashes($_POST["capital"]); $soc->tva_intra = stripslashes($_POST["tva_intra_code"] . $_POST["tva_intra_num"]); $soc->forme_juridique_code = stripslashes($_POST["forme_juridique_code"]); @@ -178,14 +180,15 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') } "; - print "<script language=\"javascript\">\n$js_OpenPopupWindow\n</script>\n"; print '<form action="soc.php" method="post" name="formsoc">'; print '<input type="hidden" name="codeclient_modifiable" value="1">'; + print '<input type="hidden" name="codefournisseur_modifiable" value="1">'; print '<table class="border" width="100%">'; - print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="30" name="nom" value="'.$soc->nom.'"></td></tr>'; + print '<tr><td>'.$langs->trans('Name').'</td><td><input type="text" size="30" name="nom" value="'.$soc->nom.'"></td>'; + print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" name="prefix_comm" value="'.$soc->prefix_comm.'"></td></tr>'; // On positionne pays_id, pays_code et libelle du pays choisi $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:(defined(MAIN_INFO_SOCIETE_PAYS)?MAIN_INFO_SOCIETE_PAYS:''); @@ -215,8 +218,8 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') } if ($step==2 || ! defined("COMPANY_CREATE_TWO_STEPS")) { - print '<tr><td>'.$langs->trans('CustomerCode').'/' . $langs->trans('SupplierCode') .'</td><td><input size="16" type="text" name="code_client" maxlength="15" value="'.$soc->code_client.'"></td>'; - print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" name="prefix_comm" value="'.$soc->prefix_comm.'"></td></tr>'; + print '<tr><td>'.$langs->trans('CustomerCode').'</td><td colspan="3"><input size="16" type="text" name="code_client" maxlength="15" value="'.$soc->code_client.'"></td>'; + print '<tr><td>'.$langs->trans('SupplierCode').'</td><td colspan="3"><input size="16" type="text" name="code_fournisseur" maxlength="15" value="'.$soc->code_fournisseur.'"></td>'; if (defined("COMPANY_CREATE_TWO_STEPS")) { print '<tr><td width="140">'.$langs->trans('Country').'</td><td colspan="3">'; @@ -326,12 +329,17 @@ elseif ($_GET["action"] == 'edit') print '<form action="soc.php?socid='.$soc->id.'" method="post">'; print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="codeclient_modifiable" value="'.$soc->codeclient_modifiable.'">'; + print '<input type="hidden" name="codefournisseur_modifiable" value="'.$soc->codefournisseur_modifiable.'">'; print '<table class="border" width="100%">'; print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="nom" value="'.$soc->nom.'"></td></tr>'; - print '<tr><td>'.$langs->trans('CustomerCode').'</td><td>'; + print '<td>'.$langs->trans("Prefix").'</td><td colspan="3">'; + print '<input type="text" size="5" name="prefix_comm" value="'.$soc->prefix_comm.'">'; + print '</td>'; + + print '<tr><td>'.$langs->trans('CustomerCode').'</td><td colspan="3">'; if ($soc->codeclient_modifiable == 1) { print '<input type="text" name="code_client" size="16" value="'.$soc->code_client.'" maxlength="15">'; @@ -340,7 +348,17 @@ elseif ($_GET["action"] == 'edit') { print $soc->code_client; } - print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" name="prefix_comm" value="'.$soc->prefix_comm.'"></td>'; + print '</tr>'; + + print '<tr><td>'.$langs->trans('SupplierCode').'</td><td colspan="3">'; + if ($soc->codefournisseur_modifiable == 1) + { + print '<input type="text" name="code_client" size="16" value="'.$soc->code_fournisseur.'" maxlength="15">'; + } + else + { + print $soc->code_fournisseur; + } print '</tr>'; print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">'; @@ -484,12 +502,24 @@ else print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>'; - print '<tr><td>'; - print $langs->trans('CustomerCode').'</td><td width="20%">'; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); - print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>'; + print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>'; + + if ($soc->client) { + print '<tr><td>'; + print $langs->trans('CustomerCode').'</td><td colspan="3">'; + print $soc->code_client; + if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); + print '</td></tr>'; + } + if ($soc->fournisseur) { + print '<tr><td>'; + print $langs->trans('SupplierCode').'</td><td colspan="3">'; + print $soc->code_fournisseur; + if ($soc->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode"); + print '</td></tr>'; + } + print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>"; print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$soc->cp."</td>"; @@ -532,11 +562,12 @@ else print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3">'.$soc->capital.' '.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; + // Statut juridique print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$soc->forme_juridique.'</td></tr>'; + // Type + Staff $arr = $soc->typent_array($soc->typent_id); $soc->typent= $arr[$soc->typent_id]; - print '<tr><td>'.$langs->trans("Type").'</td><td>'.$soc->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$soc->effectif.'</td></tr>'; // RIB diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 36d815e6a38aecd4560c28bcfecebeec53835d4f..4d123adad402da29973fab705ab40db358bc33bc 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -54,10 +54,12 @@ class Societe { var $forme_juridique_code; var $forme_juridique; var $client; - var $note; var $fournisseur; var $code_client; + var $code_fournisseur; var $code_compta; + var $code_compta_fournisseur; + var $note; var $stcomm_id; var $statut_commercial; @@ -80,21 +82,20 @@ class Societe { $this->effectif_id = 0; $this->forme_juridique_code = 0; - if (defined('CODECLIENT_ADDON') && strlen(CODECLIENT_ADDON) > 0) - { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECLIENT_ADDON.'.php'; - - $var = CODECLIENT_ADDON; - } - else - { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/mod_codeclient_leopard.php'; - - $var = "mod_codeclient_leopard"; - } + // definit module code client + if (defined('CODECLIENT_ADDON') && strlen(CODECLIENT_ADDON) > 0) $var = CODECLIENT_ADDON; + else $var = "mod_codeclient_leopard"; + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$var.'.php'; $this->mod_codeclient = new $var; + $this->codeclient_modifiable = $this->mod_codeclient->modifiable; + + // definit module code fournisseur + if (defined('CODEFOURNISSEUR_ADDON') && strlen(CODEFOURNISSEUR_ADDON) > 0) $var = CODEFOURNISSEUR_ADDON; + else $var = "mod_codeclient_leopard"; + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$var.'.php'; + $this->mod_codefournisseur = new $var; $this->codeclient_modifiable = $this->mod_codeclient->modifiable; return 1; @@ -341,13 +342,32 @@ class Societe { $sql .= ", code_client = ".($this->code_client?"'".$this->code_client."'":"null"); - // Attention check_codecompta peut modifier le code + // Attention check_codecompta_client peut modifier le code // suivant le module utilis� - $this->check_codecompta(); + $this->check_codecompta_client(); $sql .= ", code_compta = ".($this->code_compta?"'".$this->code_compta."'":"null"); } + + if ($this->creation_bit || $this->codefournisseur_modifiable) + { + // Attention check_codefournisseur peut modifier le code + // suivant le module utilis� + + $this->check_codefournisseur(); + + $sql .= ", code_fournisseur = ".($this->code_fournisseur?"'".$this->code_fournisseur."'":"null"); + + // Attention check_codecompta_fournisseur peut modifier le code + // suivant le module utilis� + + $this->check_codecompta_fournisseur(); + + $sql .= ", code_compta_fournisseur = ".($this->code_compta_fournisseur?"'".$this->code_compta_fournisseur."'":"null"); + } + + if ($user) $sql .= ",fk_user_modif = '".$user->id."'"; @@ -457,13 +477,18 @@ class Societe { $this->code_client = $obj->code_client; - if (strlen($this->code_client) == 0 && $this->mod_codeclient->code_modifiable_null == 1) + if (! $this->code_client && $this->mod_codeclient->code_modifiable_null == 1) { $this->codeclient_modifiable = 1; } + if (! $this->code_fournisseur && $this->mod_codefournisseur->code_modifiable_null == 1) + { + $this->codefournisseur_modifiable = 1; + } $this->code_compta = $obj->code_compta; + $this->code_compta_fournisseur = $obj->code_compta_fournisseur; $this->tva_intra = $obj->tva_intra; $this->tva_intra_code = substr($obj->tva_intra,0,2); @@ -1172,36 +1197,86 @@ class Societe { return 0; } } - - /** - * \brief Renvoie un code compta, suivant le module le code compta renvoy� - * peut �tre identique � celui saisit ou g�n�r� automatiquement - * - * A ce jour seul la g�n�ration automatique est impl�ment�e - */ - function check_codecompta() + + function check_codefournisseur() { - if (defined('CODECOMPTA_ADDON') && strlen(CODECOMPTA_ADDON) > 0) + if (defined('CODEFOURNISSEUR_ADDON') && strlen(CODEFOURNISSEUR_ADDON) > 0) { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECOMPTA_ADDON.'.php'; - - $var = CODECOMPTA_ADDON; - $mod = new $var; + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODEFOURNISSEUR_ADDON.'.php'; - $result = $mod->get_code($this->db, $this); + $var = CODEFOURNISSEUR_ADDON; - $this->code_compta = $mod->code; + $mod = new $var; - return $result; + return $mod->verif($this->db, $this->code_fournisseur); } else { - $this->code_compta = ''; return 0; } } + + /** + * \brief Renvoie un code compta, suivant le module le code compta renvoy� + * peut �tre identique � celui saisit ou g�n�r� automatiquement + * + * A ce jour seul la g�n�ration automatique est impl�ment�e + */ + function check_codecompta_client() + { + if (defined('CODECOMPTA_ADDON') && strlen(CODECOMPTA_ADDON) > 0) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECOMPTA_ADDON.'.php'; + + $var = CODECOMPTA_ADDON; + + $mod = new $var; + + $result = $mod->get_code($this->db, $this); + + $this->code_compta = $mod->code; + + return $result; + } + else + { + $this->code_compta = ''; + return 0; + } + } + + /** + * \brief Renvoie un code compta, suivant le module le code compta renvoy� + * peut �tre identique � celui saisit ou g�n�r� automatiquement + * + * A ce jour seul la g�n�ration automatique est impl�ment�e + */ + function check_codecompta_fournisseur() + { + if (defined('CODECOMPTAFOURN_ADDON') && strlen(CODECOMPTAFOURN_ADDON) > 0) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECOMPTAFOURN_ADDON.'.php'; + + $var = CODECOMPTAFOURN_ADDON; + + $mod = new $var; + + $result = $mod->get_code($this->db, $this); + + $this->code_compta_fournisseur = $mod->code; + + return $result; + } + else + { + $this->code_compta = ''; + return 0; + } + } + + /** * \brief D�fini la soci�t� m�re pour les filiales * \param id id compagnie m�re � positionner