Gestion du code fournisseur
This commit is contained in:
parent
9982f15a99
commit
9cbb07e1ac
@ -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>";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>";
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
|
||||
@ -36,4 +36,6 @@ DatePayment=Payment date
|
||||
NewVATPayment=New VAT payment
|
||||
VATPayment=VAT Payment
|
||||
VATPayments=VAT Payments
|
||||
TotalToPay=Total to pay
|
||||
TotalToPay=Total to pay
|
||||
CustomerAccountancyCode=Customer accountancy code
|
||||
SupplierAccountancyCode=Supplier accountacy code
|
||||
@ -37,4 +37,6 @@ DatePayment=Date paiement
|
||||
NewVATPayment=Nouveau paiment de TVA
|
||||
VATPayment=Réglement TVA
|
||||
VATPayments=Réglements TVA
|
||||
TotalToPay=Total à payer
|
||||
TotalToPay=Total à payer
|
||||
CustomerAccountancyCode=Code compta client
|
||||
SupplierAccountancyCode=Code compta founisseur
|
||||
@ -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
|
||||
|
||||
@ -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,6 +1197,25 @@ class Societe {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function check_codefournisseur()
|
||||
{
|
||||
if (defined('CODEFOURNISSEUR_ADDON') && strlen(CODEFOURNISSEUR_ADDON) > 0)
|
||||
{
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODEFOURNISSEUR_ADDON.'.php';
|
||||
|
||||
$var = CODEFOURNISSEUR_ADDON;
|
||||
|
||||
$mod = new $var;
|
||||
|
||||
return $mod->verif($this->db, $this->code_fournisseur);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie un code compta, suivant le module le code compta renvoyé
|
||||
@ -1179,29 +1223,60 @@ class Societe {
|
||||
*
|
||||
* A ce jour seul la génération automatique est implémentée
|
||||
*/
|
||||
function check_codecompta()
|
||||
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;
|
||||
}
|
||||
{
|
||||
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;
|
||||
}
|
||||
{
|
||||
$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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user